diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/ClassesOrderRootTypeUIFactory.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/ClassesOrderRootTypeUIFactory.java
index c2d3d801a211..6a8a34320365 100644
--- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/ClassesOrderRootTypeUIFactory.java
+++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/ClassesOrderRootTypeUIFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -16,12 +16,17 @@
package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.icons.AllIcons;
+import com.intellij.lang.LangBundle;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.ui.SdkPathEditor;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory;
+import com.intellij.openapi.vfs.JrtFileSystem;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.ui.components.JBList;
+import com.intellij.util.PlatformIcons;
import javax.swing.*;
@@ -33,7 +38,7 @@ public class ClassesOrderRootTypeUIFactory implements OrderRootTypeUIFactory {
@Override
public SdkPathEditor createPathEditor(Sdk sdk) {
FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, false, true, true);
- return new SdkPathEditor(ProjectBundle.message("sdk.configure.classpath.tab"), OrderRootType.CLASSES, descriptor);
+ return new MySdkPathEditor(descriptor);
}
@Override
@@ -45,4 +50,42 @@ public class ClassesOrderRootTypeUIFactory implements OrderRootTypeUIFactory {
public String getNodeText() {
return ProjectBundle.message("library.classes.node");
}
+
+ private static class MySdkPathEditor extends SdkPathEditor {
+ public MySdkPathEditor(FileChooserDescriptor descriptor) {
+ super(ProjectBundle.message("sdk.configure.classpath.tab"), OrderRootType.CLASSES, descriptor);
+ }
+
+ @Override
+ protected boolean isRemoveActionEnabled(Object[] values) {
+ if (!super.isRemoveActionEnabled(values)) {
+ return false;
+ }
+ for (Object value : values) {
+ if (isJrtRoot(value)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ protected ListCellRenderer createListCellRenderer(JBList list) {
+ return new PathCellRenderer() {
+ @Override
+ protected String getItemText(Object value) {
+ return isJrtRoot(value) ? LangBundle.message("jrt.node.long") : super.getItemText(value);
+ }
+
+ @Override
+ protected Icon getItemIcon(Object value) {
+ return isJrtRoot(value) ? PlatformIcons.JAR_ICON : super.getItemIcon(value);
+ }
+ };
+ }
+ }
+
+ private static boolean isJrtRoot(Object value) {
+ return value instanceof VirtualFile && JrtFileSystem.isRoot((VirtualFile)value);
+ }
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java
index c67d4c995b1f..f5d21fd70282 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/InferredAnnotationsManagerImpl.java
@@ -82,24 +82,20 @@ public class InferredAnnotationsManagerImpl extends InferredAnnotationsManager {
if (owner instanceof PsiMethod && PsiUtil.canBeOverriden((PsiMethod)owner)) {
return true;
}
- if (ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotationFQN) && hasHardcodedContracts(owner)) {
+ if (ORG_JETBRAINS_ANNOTATIONS_CONTRACT.equals(annotationFQN) && HardcodedContracts.hasHardcodedContracts(owner)) {
return true;
}
if (AnnotationUtil.NOT_NULL.equals(annotationFQN) && owner instanceof PsiParameter && owner.getParent() != null) {
if (AnnotationUtil.isAnnotated(owner, NullableNotNullManager.getInstance(owner.getProject()).getNullables(), false, false)) {
return true;
}
- if (hasHardcodedContracts(owner.getParent().getParent())) {
+ if (HardcodedContracts.hasHardcodedContracts(owner)) {
return true;
}
}
return false;
}
- private static boolean hasHardcodedContracts(PsiElement owner) {
- return owner instanceof PsiMethod && !HardcodedContracts.getHardcodedContracts((PsiMethod)owner, null).isEmpty();
- }
-
@Nullable
private PsiAnnotation getInferredContractAnnotation(PsiMethod method) {
if (method.getModifierList().findAnnotation(ORG_JETBRAINS_ANNOTATIONS_CONTRACT) != null) {
diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
index 76da573725a8..e1fdc3840f2a 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/GenericsHighlightUtil.java
@@ -1173,7 +1173,7 @@ public class GenericsHighlightUtil {
public static HighlightInfo checkEnumMustNotBeLocal(final PsiClass aClass) {
if (!aClass.isEnum()) return null;
PsiElement parent = aClass.getParent();
- if (!(parent instanceof PsiClass || parent instanceof PsiFile)) {
+ if (!(parent instanceof PsiClass || parent instanceof PsiFile || parent instanceof PsiClassLevelDeclarationStatement)) {
String description = JavaErrorMessages.message("local.enum");
TextRange textRange = HighlightNamesUtil.getClassDeclarationTextRange(aClass);
return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(textRange).descriptionAndTooltip(description).create();
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
index f1a601117e62..cbb715cb12b1 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/AnonymousCanBeLambdaInspection.java
@@ -35,6 +35,7 @@ import com.intellij.psi.controlFlow.AnalysisCanceledException;
import com.intellij.psi.controlFlow.ControlFlow;
import com.intellij.psi.controlFlow.ControlFlowUtil;
import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
+import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil;
import com.intellij.psi.infos.MethodCandidateInfo;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
@@ -439,7 +440,7 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
PsiAnonymousClass aClass) {
myMethod = method;
myAnonymClass = aClass;
- final PsiType inferredType = getInferredType(aClass);
+ final PsiType inferredType = FunctionalInterfaceParameterizationUtil.getGroundTargetType(getInferredType(aClass));
myEqualInference = !aClass.getBaseClassType().equals(inferredType);
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java
index f9e58134c860..05743b52c137 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/HardcodedContracts.java
@@ -164,4 +164,16 @@ public class HardcodedContracts {
return true;
}
+
+ public static boolean hasHardcodedContracts(@Nullable PsiElement element) {
+ if (element instanceof PsiMethod) {
+ return !getHardcodedContracts((PsiMethod)element, null).isEmpty();
+ }
+
+ if (element instanceof PsiParameter) {
+ return hasHardcodedContracts(element.getParent().getParent());
+ }
+
+ return false;
+ }
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java
index e35aa3aa80a5..22d347ee1ecb 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaUtilImpl.java
@@ -20,6 +20,7 @@
*/
package com.intellij.codeInspection.reference;
+import com.intellij.codeInsight.ExceptionUtil;
import com.intellij.codeInspection.InspectionsBundle;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
@@ -30,6 +31,9 @@ import com.intellij.util.VisibilityUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.Collection;
+import java.util.Collections;
+
public class RefJavaUtilImpl extends RefJavaUtil{
@Override
@@ -114,6 +118,29 @@ public class RefJavaUtilImpl extends RefJavaUtil{
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(aClass);
if (interfaceMethod != null) {
refFrom.addReference(refFrom.getRefManager().getReference(interfaceMethod), interfaceMethod, psiFrom, false, true, null);
+
+ PsiElement body = null;
+ PsiElement topElement = null;
+ if (expression instanceof PsiLambdaExpression) {
+ body = ((PsiLambdaExpression)expression).getBody();
+ topElement = expression;
+ }
+ else {
+ final PsiElement resolve = ((PsiMethodReferenceExpression)expression).resolve();
+ if (resolve instanceof PsiMethod) {
+ body = ((PsiMethod)resolve).getBody();
+ topElement = resolve;
+ }
+ }
+
+ final Collection exceptionTypes = body != null ? ExceptionUtil.collectUnhandledExceptions(body, topElement, false)
+ : Collections.emptyList();
+ RefElement refResolved = refFrom.getRefManager().getReference(interfaceMethod);
+ if (refResolved instanceof RefMethodImpl) {
+ for (final PsiClassType exceptionType : exceptionTypes) {
+ ((RefMethodImpl)refResolved).updateThrowsList(exceptionType);
+ }
+ }
}
}
}
diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java
index 6c045fa4270b..293e23796148 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java
@@ -24,7 +24,7 @@ import org.intellij.lang.annotations.Pattern;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
-public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool implements PairedUnfairLocalInspectionTool {
+public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool {
@NonNls public static final String SHORT_NAME = HighlightInfoType.UNUSED_SYMBOL_SHORT_NAME;
@NonNls public static final String DISPLAY_NAME = HighlightInfoType.UNUSED_SYMBOL_DISPLAY_NAME;
@NonNls public static final String UNUSED_PARAMETERS_SHORT_NAME = "UnusedParameters";
@@ -74,9 +74,4 @@ public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool
return true;
}
- @NotNull
- @Override
- public String getInspectionForBatchShortName() {
- return UnusedDeclarationInspectionBase.SHORT_NAME;
- }
}
diff --git a/java/openapi/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java b/java/java-impl/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java
similarity index 80%
rename from java/openapi/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java
rename to java/java-impl/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java
index c817c3019275..adb18e11b682 100644
--- a/java/openapi/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java
+++ b/java/java-impl/src/com/intellij/codeInsight/NullableNotNullManagerImpl.java
@@ -15,13 +15,19 @@
*/
package com.intellij.codeInsight;
+import com.intellij.codeInspection.dataFlow.HardcodedContracts;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
+import com.intellij.psi.PsiElement;
@State(
name = "NullableNotNullManager",
storages = {@Storage(file = StoragePathMacros.PROJECT_FILE)}
)
public class NullableNotNullManagerImpl extends NullableNotNullManager {
+ protected boolean hasHardcodedContracts(PsiElement element) {
+ return HardcodedContracts.hasHardcodedContracts(element);
+ }
+
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java
index 5c2318bb8281..cb3543aecc94 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java
@@ -27,7 +27,6 @@ package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.lookup.CharFilter;
import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.codeInsight.lookup.impl.LookupImpl;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.patterns.PsiJavaPatterns;
import com.intellij.pom.java.LanguageLevel;
@@ -61,6 +60,9 @@ public class JavaCharFilter extends CharFilter {
final PsiType type = ((PsiMethod)o).getReturnType();
if (type != null && PsiType.BOOLEAN.isAssignableFrom(type)) return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
}
+ if (o instanceof PsiKeyword && ((PsiKeyword)o).textMatches(PsiKeyword.INSTANCEOF)) {
+ return Result.SELECT_ITEM_AND_FINISH_LOOKUP;
+ }
return null;
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
index f5e43aa7bcec..77c6eb0d17cc 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionData.java
@@ -19,10 +19,7 @@ import com.intellij.codeInsight.ExpectedTypeInfo;
import com.intellij.codeInsight.TailType;
import com.intellij.codeInsight.TailTypes;
import com.intellij.codeInsight.completion.util.ParenthesesInsertHandler;
-import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.codeInsight.lookup.LookupItem;
-import com.intellij.codeInsight.lookup.PsiTypeLookupItem;
-import com.intellij.codeInsight.lookup.TailTypeDecorator;
+import com.intellij.codeInsight.lookup.*;
import com.intellij.patterns.ElementPattern;
import com.intellij.patterns.PsiJavaElementPattern;
import com.intellij.pom.java.LanguageLevel;
@@ -491,7 +488,29 @@ public class JavaCompletionData extends JavaAwareCompletionData {
}
if (isInstanceofPlace(position)) {
- result.addElement(TailTypeDecorator.withTail(createKeyword(position, PsiKeyword.INSTANCEOF), TailType.HUMBLE_SPACE_BEFORE_WORD));
+ result.addElement(LookupElementDecorator.withInsertHandler(
+ createKeyword(position, PsiKeyword.INSTANCEOF),
+ new InsertHandler>() {
+ @Override
+ public void handleInsert(InsertionContext context, LookupElementDecorator item) {
+ TailType tailType = TailType.HUMBLE_SPACE_BEFORE_WORD;
+ if (tailType.isApplicable(context)) {
+ tailType.processTail(context.getEditor(), context.getTailOffset());
+ }
+
+ if ('!' == context.getCompletionChar()) {
+ context.setAddCompletionChar(false);
+ context.commitDocument();
+ PsiInstanceOfExpression expr =
+ PsiTreeUtil.findElementOfClassAtOffset(context.getFile(), context.getStartOffset(), PsiInstanceOfExpression.class, false);
+ if (expr != null) {
+ String space = context.getCodeStyleSettings().SPACE_WITHIN_PARENTHESES ? " " : "";
+ context.getDocument().insertString(expr.getTextRange().getStartOffset(), "!(" + space);
+ context.getDocument().insertString(context.getTailOffset(), space + ")");
+ }
+ }
+ }
+ }));
}
if (isSuitableForClass(position)) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
index 8ae9622f3440..e636ab4fc9b4 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
@@ -18,6 +18,7 @@ package com.intellij.codeInsight.completion;
import com.intellij.codeInsight.generation.*;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
+import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.Key;
@@ -30,10 +31,7 @@ import com.intellij.util.VisibilityUtil;
import com.intellij.util.containers.ContainerUtil;
import javax.swing.*;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
import static com.intellij.patterns.PlatformPatterns.psiElement;
@@ -137,6 +135,17 @@ public class JavaGenerateMemberCompletionContributor {
List> newInfos = GenerateMembersUtil
.insertMembersAtOffset(context.getFile(), context.getStartOffset(), infos);
if (!newInfos.isEmpty()) {
+ final List elements = new ArrayList();
+ for (GenerationInfo member : newInfos) {
+ if (!(member instanceof TemplateGenerationInfo)) {
+ final PsiMember psiMember = member.getPsiMember();
+ if (psiMember != null) {
+ elements.add(psiMember);
+ }
+ }
+ }
+
+ GlobalInspectionContextBase.cleanupElements(context.getProject(), null, elements.toArray(new PsiElement[elements.size()]));
newInfos.get(0).positionCaret(context.getEditor(), true);
}
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavadocCompletionConfidence.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavadocCompletionConfidence.java
index 6d6bd29f01c7..3f09e08b2a2f 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavadocCompletionConfidence.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavadocCompletionConfidence.java
@@ -33,11 +33,16 @@ public class JavadocCompletionConfidence extends CompletionConfidence {
@NotNull
@Override
public ThreeState shouldSkipAutopopup(@NotNull PsiElement contextElement, @NotNull PsiFile psiFile, int offset) {
- if (psiElement().inside(PsiDocTag.class).accepts(contextElement) && findJavaReference(psiFile, offset - 1) != null) {
- return ThreeState.NO;
- }
- if (PlatformPatterns.psiElement(JavaDocTokenType.DOC_TAG_NAME).accepts(contextElement)) {
- return ThreeState.NO;
+ if (psiElement().inside(PsiDocTag.class).accepts(contextElement)) {
+ if (findJavaReference(psiFile, offset - 1) != null) {
+ return ThreeState.NO;
+ }
+ if (PlatformPatterns.psiElement(JavaDocTokenType.DOC_TAG_NAME).accepts(contextElement)) {
+ return ThreeState.NO;
+ }
+ if (contextElement.textMatches("#")) {
+ return ThreeState.NO;
+ }
}
return super.shouldSkipAutopopup(contextElement, psiFile, offset);
}
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionToCatchFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionToCatchFix.java
index 5d51949c1d6b..cc43f962fc19 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionToCatchFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExceptionToCatchFix.java
@@ -171,8 +171,8 @@ public class AddExceptionToCatchFix extends BaseIntentionAction {
if (element == null) return null;
@SuppressWarnings({"unchecked"})
- final PsiElement parent = PsiTreeUtil.getParentOfType(element, PsiTryStatement.class, PsiMethod.class);
- if (parent == null || parent instanceof PsiMethod) return null;
+ final PsiElement parent = PsiTreeUtil.getParentOfType(element, PsiTryStatement.class, PsiMethod.class, PsiFunctionalExpression.class);
+ if (parent == null || parent instanceof PsiMethod || parent instanceof PsiFunctionalExpression) return null;
final PsiTryStatement statement = (PsiTryStatement) parent;
final PsiCodeBlock tryBlock = statement.getTryBlock();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/GeneralizeCatchFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/GeneralizeCatchFix.java
index 64ad43808b86..2f7c34e47886 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/GeneralizeCatchFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/GeneralizeCatchFix.java
@@ -63,7 +63,7 @@ public class GeneralizeCatchFix implements IntentionAction {
myTryStatement = (PsiTryStatement)element.getParent();
break;
}
- if (element instanceof PsiMethod || (element instanceof PsiClass && !(element instanceof PsiAnonymousClass))) break;
+ if (element instanceof PsiMethod || element instanceof PsiFunctionalExpression || (element instanceof PsiClass && !(element instanceof PsiAnonymousClass))) break;
element = element.getParent();
}
if (myTryStatement == null) return false;
diff --git a/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java b/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java
index c5db82aca2e7..563f5d25ebd5 100644
--- a/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java
+++ b/java/java-impl/src/com/intellij/ide/navigationToolbar/JavaNavBarExtension.java
@@ -16,9 +16,11 @@
package com.intellij.ide.navigationToolbar;
import com.intellij.analysis.AnalysisScopeBundle;
+import com.intellij.lang.LangBundle;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
+import com.intellij.openapi.vfs.JrtFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.presentation.java.ClassPresentationUtil;
@@ -39,6 +41,9 @@ public class JavaNavBarExtension extends AbstractNavBarModelExtension {
final String name = ((PsiPackage)object).getName();
return name != null ? name : AnalysisScopeBundle.message("dependencies.tree.node.default.package.abbreviation");
}
+ else if (object instanceof PsiDirectory && JrtFileSystem.isRoot(((PsiDirectory)object).getVirtualFile())) {
+ return LangBundle.message("jrt.node.short");
+ }
return null;
}
diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/JavaProjectViewDirectoryHelper.java b/java/java-impl/src/com/intellij/ide/projectView/impl/JavaProjectViewDirectoryHelper.java
index 78fedc9034bf..b85bda71ab44 100644
--- a/java/java-impl/src/com/intellij/ide/projectView/impl/JavaProjectViewDirectoryHelper.java
+++ b/java/java-impl/src/com/intellij/ide/projectView/impl/JavaProjectViewDirectoryHelper.java
@@ -20,8 +20,10 @@ import com.intellij.ide.projectView.impl.nodes.PackageElement;
import com.intellij.ide.projectView.impl.nodes.PackageUtil;
import com.intellij.ide.projectView.impl.nodes.ProjectViewDirectoryHelper;
import com.intellij.ide.util.treeView.TreeViewUtil;
+import com.intellij.lang.LangBundle;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.impl.DirectoryIndex;
+import com.intellij.openapi.vfs.JrtFileSystem;
import com.intellij.psi.JavaDirectoryService;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiPackage;
@@ -61,6 +63,10 @@ public class JavaProjectViewDirectoryHelper extends ProjectViewDirectoryHelper {
@Nullable
@Override
public String getNodeName(final ViewSettings settings, final Object parentValue, final PsiDirectory directory) {
+ if (JrtFileSystem.isRoot(directory.getVirtualFile())) {
+ return LangBundle.message("jrt.node.short");
+ }
+
PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(directory);
PsiPackage parentPackage;
diff --git a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java
index f3d6575e9fd9..bce0308619e2 100644
--- a/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java
+++ b/java/java-impl/src/com/intellij/openapi/projectRoots/impl/JavaSdkImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -15,8 +15,10 @@
*/
package com.intellij.openapi.projectRoots.impl;
+import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.util.ExecUtil;
import com.intellij.icons.AllIcons;
+import com.intellij.lang.LangBundle;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -28,12 +30,12 @@ import com.intellij.openapi.roots.JavadocOrderRootType;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.HashMap;
import org.jdom.Element;
-import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.java.impl.JavaSdkUtil;
@@ -51,13 +53,14 @@ import java.util.regex.Pattern;
*/
public class JavaSdkImpl extends JavaSdk {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.projectRoots.impl.JavaSdkImpl");
- // do not use javaw.exe for Windows because of issues with encoding
- @NonNls private static final String VM_EXE_NAME = "java";
- @NonNls private final Pattern myVersionStringPattern = Pattern.compile("^(.*)java version \"([1234567890_.]*)\"(.*)$");
- @NonNls private static final String JAVA_VERSION_PREFIX = "java version ";
- @NonNls private static final String OPENJDK_VERSION_PREFIX = "openjdk version ";
+
public static final DataKey KEY = DataKey.create("JavaSdk");
+ private static final String VM_EXE_NAME = "java"; // do not use JavaW.exe for Windows because of issues with encoding
+ private static final Pattern VERSION_STRING_PATTERN = Pattern.compile("^(.*)java version \"([1234567890_.]*)\"(.*)$");
+ private static final String JAVA_VERSION_PREFIX = "java version ";
+ private static final String OPENJDK_VERSION_PREFIX = "openjdk version ";
+
public JavaSdkImpl() {
super("JavaSDK");
}
@@ -83,7 +86,6 @@ public class JavaSdkImpl extends JavaSdk {
return AllIcons.General.AddJdk;
}
- @NonNls
@Override
@Nullable
public String getDefaultDocumentationUrl(@NotNull final Sdk sdk) {
@@ -119,7 +121,6 @@ public class JavaSdkImpl extends JavaSdk {
}
@Override
- @NonNls
public String getToolsPath(@NotNull Sdk sdk) {
final String versionString = sdk.getVersionString();
final boolean isJdk1_x = versionString != null && (versionString.contains("1.0") || versionString.contains("1.1"));
@@ -128,11 +129,6 @@ public class JavaSdkImpl extends JavaSdk {
@Override
public String getVMExecutablePath(@NotNull Sdk sdk) {
- /*
- if ("64".equals(System.getProperty("sun.arch.data.model"))) {
- return getBinPath(sdk) + File.separator + System.getProperty("os.arch") + File.separator + VM_EXE_NAME;
- }
- */
return getBinPath(sdk) + File.separator + VM_EXE_NAME;
}
@@ -150,8 +146,8 @@ public class JavaSdkImpl extends JavaSdk {
@SuppressWarnings({"HardCodedStringLiteral"})
public String suggestHomePath() {
if (SystemInfo.isMac) {
- if (new File("/usr/libexec/java_home").exists()) {
- final String path = ExecUtil.execAndReadLine("/usr/libexec/java_home");
+ if (new File("/usr/libexec/java_home").canExecute()) {
+ String path = ExecUtil.execAndReadLine(new GeneralCommandLine("/usr/libexec/java_home"));
if (path != null && new File(path).exists()) {
return path;
}
@@ -180,6 +176,7 @@ public class JavaSdkImpl extends JavaSdk {
return javaHome.getAbsolutePath();
}
}
+
return null;
}
@@ -239,20 +236,27 @@ public class JavaSdkImpl extends JavaSdk {
@Override
public FileChooserDescriptor getHomeChooserDescriptor() {
- FileChooserDescriptor descriptor = super.getHomeChooserDescriptor();
+ final FileChooserDescriptor baseDescriptor = super.getHomeChooserDescriptor();
+ final FileChooserDescriptor descriptor = new FileChooserDescriptor(baseDescriptor) {
+ @Override
+ public void validateSelectedFiles(VirtualFile[] files) throws Exception {
+ if (files.length > 0 && JrtFileSystem.isModularJdk(files[0].getPath()) && !JrtFileSystem.isSupported()) {
+ throw new Exception(LangBundle.message("jrt.not.available.message"));
+ }
+ baseDescriptor.validateSelectedFiles(files);
+ }
+ };
descriptor.putUserData(KEY, Boolean.TRUE);
return descriptor;
}
- @NonNls public static final String MAC_HOME_PATH = "/Home";
-
@Override
public String adjustSelectedSdkHome(String homePath) {
if (SystemInfo.isMac) {
- File home = new File(homePath, MAC_HOME_PATH);
+ File home = new File(homePath, "/Home");
if (home.exists()) return home.getPath();
- home = new File(new File(homePath, "Contents"), "Home");
+ home = new File(homePath, "Contents/Home");
if (home.exists()) return home.getPath();
}
@@ -261,14 +265,20 @@ public class JavaSdkImpl extends JavaSdk {
@Override
public boolean isValidSdkHome(String path) {
- return checkForJdk(new File(path));
+ if (!checkForJdk(new File(path))) {
+ return false;
+ }
+ if (JrtFileSystem.isModularJdk(path) && !JrtFileSystem.isSupported()) {
+ return false;
+ }
+ return true;
}
@Override
public String suggestSdkName(String currentSdkName, String sdkHome) {
final String suggestedName;
if (currentSdkName != null && !currentSdkName.isEmpty()) {
- final Matcher matcher = myVersionStringPattern.matcher(currentSdkName);
+ final Matcher matcher = VERSION_STRING_PATTERN.matcher(currentSdkName);
final boolean replaceNameWithVersion = matcher.matches();
if (replaceNameWithVersion){
// user did not change name -> set it automatically
@@ -315,13 +325,16 @@ public class JavaSdkImpl extends JavaSdk {
@Override
@SuppressWarnings({"HardCodedStringLiteral"})
public void setupSdkPaths(@NotNull Sdk sdk) {
- final File jdkHome = new File(sdk.getHomePath());
+ String homePath = sdk.getHomePath();
+ assert homePath != null : sdk;
+
+ File jdkHome = new File(homePath);
List classes = findClasses(jdkHome, false);
VirtualFile sources = findSources(jdkHome);
VirtualFile docs = findDocs(jdkHome, "docs/api");
+ SdkModificator sdkModificator = sdk.getSdkModificator();
- final SdkModificator sdkModificator = sdk.getSdkModificator();
- final Set previousRoots = new LinkedHashSet(Arrays.asList(sdkModificator.getRoots(OrderRootType.CLASSES)));
+ Set previousRoots = new LinkedHashSet(Arrays.asList(sdkModificator.getRoots(OrderRootType.CLASSES)));
sdkModificator.removeRoots(OrderRootType.CLASSES);
previousRoots.removeAll(new HashSet(classes));
for (VirtualFile aClass : classes) {
@@ -330,14 +343,16 @@ public class JavaSdkImpl extends JavaSdk {
for (VirtualFile root : previousRoots) {
sdkModificator.addRoot(root, OrderRootType.CLASSES);
}
- if(sources != null){
+
+ if (sources != null) {
sdkModificator.addRoot(sources, OrderRootType.SOURCES);
}
- final VirtualFile javaFxSources = findSources(jdkHome, "javafx-src");
+ VirtualFile javaFxSources = findSources(jdkHome, "javafx-src");
if (javaFxSources != null) {
sdkModificator.addRoot(javaFxSources, OrderRootType.SOURCES);
}
- if(docs != null){
+
+ if (docs != null) {
sdkModificator.addRoot(docs, JavadocOrderRootType.getInstance());
}
else if (SystemInfo.isMac) {
@@ -366,12 +381,14 @@ public class JavaSdkImpl extends JavaSdk {
sdkModificator.addRoot(VirtualFileManager.getInstance().findFileByUrl(url), JavadocOrderRootType.getInstance());
}
}
- } else {
- if (getVersion(sdk) == JavaSdkVersion.JDK_1_7) {
- sdkModificator.addRoot(VirtualFileManager.getInstance().findFileByUrl("http://docs.oracle.com/javafx/2/api/"), JavadocOrderRootType.getInstance());
- }
}
+ else if (getVersion(sdk) == JavaSdkVersion.JDK_1_7) {
+ VirtualFile url = VirtualFileManager.getInstance().findFileByUrl("http://docs.oracle.com/javafx/2/api/");
+ sdkModificator.addRoot(url, JavadocOrderRootType.getInstance());
+ }
+
attachJdkAnnotations(sdkModificator);
+
sdkModificator.commitChanges();
}
@@ -399,19 +416,14 @@ public class JavaSdkImpl extends JavaSdk {
private final Map myCachedVersionStrings = new HashMap();
@Override
- public final String getVersionString(final String sdkHome) {
- if (myCachedVersionStrings.containsKey(sdkHome)) {
- return myCachedVersionStrings.get(sdkHome);
+ public final String getVersionString(String sdkHome) {
+ String versionString = myCachedVersionStrings.get(sdkHome);
+ if (versionString == null) {
+ versionString = getJdkVersion(sdkHome);
+ if (!StringUtil.isEmpty(versionString)) {
+ myCachedVersionStrings.put(sdkHome, versionString);
+ }
}
- String versionString = getJdkVersion(sdkHome);
- if (versionString != null && versionString.isEmpty()) {
- versionString = null;
- }
-
- if (versionString != null){
- myCachedVersionStrings.put(sdkHome, versionString);
- }
-
return versionString;
}
@@ -464,17 +476,22 @@ public class JavaSdkImpl extends JavaSdk {
}
private static List findClasses(File file, boolean isJre) {
- List result = ContainerUtil.newArrayList();
+ List roots = JavaSdkUtil.getJdkClassesRoots(file, isJre);
+ List urls = ContainerUtil.newArrayListWithCapacity(roots.size() + 1);
+ if (JrtFileSystem.isModularJdk(file.getPath())) {
+ urls.add(VirtualFileManager.constructUrl(JrtFileSystem.PROTOCOL, FileUtil.toSystemIndependentName(file.getPath()) + JrtFileSystem.SEPARATOR));
+ }
+ for (File root : roots) {
+ urls.add(VfsUtil.getUrlForLibraryRoot(root));
+ }
- List rootFiles = JavaSdkUtil.getJdkClassesRoots(file, isJre);
- for (File child : rootFiles) {
- String url = VfsUtil.getUrlForLibraryRoot(child);
+ List result = ContainerUtil.newArrayListWithCapacity(urls.size());
+ for (String url : urls) {
VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(url);
if (vFile != null) {
result.add(vFile);
}
}
-
return result;
}
diff --git a/java/java-impl/src/com/intellij/openapi/vfs/JrtFileSystem.java b/java/java-impl/src/com/intellij/openapi/vfs/JrtFileSystem.java
new file mode 100644
index 000000000000..853a8b44d4c5
--- /dev/null
+++ b/java/java-impl/src/com/intellij/openapi/vfs/JrtFileSystem.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.openapi.vfs;
+
+import com.intellij.ide.AppLifecycleListener;
+import com.intellij.lang.LangBundle;
+import com.intellij.notification.Notification;
+import com.intellij.notification.NotificationType;
+import com.intellij.notification.Notifications;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.JavaSdkType;
+import com.intellij.openapi.projectRoots.ProjectJdkTable;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.util.SystemInfo;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.impl.ArchiveHandler;
+import com.intellij.openapi.vfs.newvfs.ArchiveFileSystem;
+import com.intellij.openapi.vfs.newvfs.VfsImplUtil;
+import com.intellij.util.Function;
+import com.intellij.util.messages.MessageBusConnection;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+
+public class JrtFileSystem extends ArchiveFileSystem {
+ public static final String PROTOCOL = "jrt";
+ public static final String SEPARATOR = JarFileSystem.JAR_SEPARATOR;
+
+ public JrtFileSystem() {
+ scheduleConfiguredSdkCheck();
+ }
+
+ private static void scheduleConfiguredSdkCheck() {
+ if (isSupported()) return;
+ final MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect();
+ connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() {
+ @Override
+ public void appStarting(Project project) {
+ for (Sdk sdk : ProjectJdkTable.getInstance().getAllJdks()) {
+ if (getHomePathIfModular(sdk) != null) {
+ String title = LangBundle.message("jrt.not.available.title", sdk.getName());
+ String message = LangBundle.message("jrt.not.available.message");
+ Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, title, message, NotificationType.WARNING));
+ }
+ }
+ connection.disconnect();
+ }
+ });
+ }
+
+ private static String getHomePathIfModular(Sdk sdk) {
+ if (sdk != null && sdk.getSdkType() instanceof JavaSdkType) {
+ String homePath = sdk.getHomePath();
+ if (homePath != null && isModularJdk(homePath)) {
+ return homePath;
+ }
+ }
+ return null;
+ }
+
+ @NotNull
+ @Override
+ public String getProtocol() {
+ return PROTOCOL;
+ }
+
+ @NotNull
+ @Override
+ protected String extractLocalPath(@NotNull String rootPath) {
+ return StringUtil.trimEnd(rootPath, SEPARATOR);
+ }
+
+ @NotNull
+ @Override
+ protected String composeRootPath(@NotNull String localPath) {
+ return localPath + SEPARATOR;
+ }
+
+ @NotNull
+ @Override
+ protected String extractRootPath(@NotNull String entryPath) {
+ int separatorIndex = entryPath.indexOf(SEPARATOR);
+ assert separatorIndex >= 0 : "Path passed to JrtFileSystem must have a separator '!/': " + entryPath;
+ return entryPath.substring(0, separatorIndex + SEPARATOR.length());
+ }
+
+ @NotNull
+ @Override
+ protected ArchiveHandler getHandler(@NotNull VirtualFile entryFile) {
+ final String homePath = extractLocalPath(extractRootPath(entryFile.getPath()));
+ return VfsImplUtil.getHandler(this, homePath + "/lib/modules", new Function() {
+ @Override
+ public ArchiveHandler fun(String localPath) {
+ return isSupported() ? new JrtHandler(homePath) : new JrtHandlerStub(homePath);
+ }
+ });
+ }
+
+ @Override
+ public VirtualFile findFileByPath(@NotNull String path) {
+ return VfsImplUtil.findFileByPath(this, path);
+ }
+
+ @Override
+ public VirtualFile findFileByPathIfCached(@NotNull String path) {
+ return VfsImplUtil.findFileByPathIfCached(this, path);
+ }
+
+ @Override
+ public VirtualFile refreshAndFindFileByPath(@NotNull String path) {
+ return VfsImplUtil.refreshAndFindFileByPath(this, path);
+ }
+
+ @Override
+ public void refresh(boolean asynchronous) {
+ VfsImplUtil.refresh(this, asynchronous);
+ }
+
+ public static boolean isSupported() {
+ return SystemInfo.isJavaVersionAtLeast("1.8") && !SystemInfo.isJavaVersionAtLeast("1.9");
+ }
+
+ public static boolean isModularJdk(@NotNull String homePath) {
+ return new File(homePath, "lib/modules").isDirectory();
+ }
+
+ public static boolean isRoot(@NotNull VirtualFile file) {
+ return file.getParent() == null && file.getFileSystem() instanceof JrtFileSystem;
+ }
+}
diff --git a/java/java-impl/src/com/intellij/openapi/vfs/JrtHandler.java b/java/java-impl/src/com/intellij/openapi/vfs/JrtHandler.java
new file mode 100644
index 000000000000..dae670dbfef0
--- /dev/null
+++ b/java/java-impl/src/com/intellij/openapi/vfs/JrtHandler.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright 2000-2015 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 com.intellij.openapi.vfs;
+
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vfs.impl.ArchiveHandler;
+import com.intellij.reference.SoftReference;
+import com.intellij.util.ArrayUtil;
+import com.intellij.util.containers.ContainerUtil;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.*;
+import java.net.URI;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+class JrtHandler extends ArchiveHandler {
+ private static final URI ROOT_URI = URI.create("jrt:/");
+ private static final Map EMPTY_ENV = Collections.emptyMap();
+
+ private static class JrtEntryInfo extends EntryInfo {
+ private final String myModule;
+
+ public JrtEntryInfo(EntryInfo parent, @NotNull String shortName, @NotNull String module, long length, long timestamp) {
+ super(parent, shortName, false, length, timestamp);
+ myModule = module;
+ }
+ }
+
+ private SoftReference
-Reports public instance variables.
+Reports public fields.
Constants (i.e. variables marked static and final) are not reported.
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/Lambda.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/Lambda.java
new file mode 100644
index 000000000000..01cdacd79161
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/abstraction/weaken_type/Lambda.java
@@ -0,0 +1,23 @@
+package com.siyeh.igtest.abstraction.weaken_type;
+
+import java.util.function.Supplier;
+
+public interface Lambda {
+
+ int count();
+
+ static Lambda newWeaken(int value) {
+ return new Lambda() {
+ @Override
+ public int count() {
+ return value;
+ }
+ };
+ }
+
+ static Supplier newSupplier() {
+ return () -> {
+ return Lambda.newWeaken(0);
+ };
+ }
+}
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_declares_clone_not_supported/CloneDeclaresCloneNonSupportedException.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_declares_clone_not_supported/CloneDeclaresCloneNonSupportedException.java
index 461fd61ca5d7..4c71a4ad77ef 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_declares_clone_not_supported/CloneDeclaresCloneNonSupportedException.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_declares_clone_not_supported/CloneDeclaresCloneNonSupportedException.java
@@ -8,7 +8,7 @@ public class CloneDeclaresCloneNonSupportedException implements Cloneable
}
- public Object clone()
+ protected Object clone()
{
try
{
@@ -34,3 +34,13 @@ class Child extends CloneDeclaresCloneNonSupportedException {
return super.clone();
}
}
+class NoWarnOnPublic implements Cloneable {
+
+ public Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new AssertionError(e);
+ }
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_declares_clone_not_supported/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_declares_clone_not_supported/expected.xml
deleted file mode 100644
index 017ae12ebb44..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/cloneable/clone_declares_clone_not_supported/expected.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- CloneDeclaresCloneNonSupportedException.java
- 11
- 'clone()' does not declare 'CloneNotSupportedException'
- <code>clone()</code> does not declare 'CloneNotSupportedException'
-
-
\ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml
index 4e19f4850c1b..d75c4d2e2d95 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/expected.xml
@@ -1,12 +1,5 @@
-
- Cyclic.java
- 9
- Cyclic class dependency
- Class 'anonymous (java.lang.Object)' is cyclically dependent on 3 other classes
-
-
Cyclic.java
17
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java
index e0f9cf48061a..e8f750c99fa3 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dependency/cyclic_class_dependency/src/Cyclic.java
@@ -27,3 +27,18 @@ interface FiveOClock {
}
interface Coffee extends FiveOClock {}
+enum MyEnum {
+ ONE {
+ public int value() {
+ return 0;
+ }
+ },
+
+ TWO {
+ public int value() {
+ return ONE.value();
+ }
+ };
+
+ abstract int value();
+}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspectionTest.java
index 52e5e8cc3db2..20e587914e40 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspectionTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/abstraction/TypeMayBeWeakenedInspectionTest.java
@@ -9,6 +9,7 @@ public class TypeMayBeWeakenedInspectionTest extends LightInspectionTestCase {
public void testTypeMayBeWeakened() { doTest(); }
public void testNumberAdderDemo() { doTest(); }
public void testAutoClosableTest() { doTest(); }
+ public void testLambda() { doTest(); }
@Override
protected String[] getEnvironmentClasses() {
@@ -33,6 +34,11 @@ public class TypeMayBeWeakenedInspectionTest extends LightInspectionTestCase {
"@FunctionalInterface " +
"public interface Function {" +
" R apply(T t);" +
+ "}",
+ "package java.util.function;\n" +
+ "@FunctionalInterface\n" +
+ "public interface Supplier {\n" +
+ " T get();\n" +
"}"
};
}
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspectionTest.java
index 5b88db3d2659..3f3a0e373801 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspectionTest.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/cloneable/CloneDeclaresCloneNotSupportedInspectionTest.java
@@ -1,10 +1,18 @@
package com.siyeh.ig.cloneable;
-import com.siyeh.ig.IGInspectionTestCase;
+import com.intellij.codeInspection.InspectionProfileEntry;
+import com.siyeh.ig.LightInspectionTestCase;
+import org.jetbrains.annotations.Nullable;
-public class CloneDeclaresCloneNotSupportedInspectionTest extends IGInspectionTestCase {
+public class CloneDeclaresCloneNotSupportedInspectionTest extends LightInspectionTestCase {
- public void test() throws Exception {
- doTest("com/siyeh/igtest/cloneable/clone_declares_clone_not_supported", new CloneDeclaresCloneNotSupportedInspection());
+ public void testCloneDeclaresCloneNonSupportedException() {
+ doTest();
+ }
+
+ @Nullable
+ @Override
+ protected InspectionProfileEntry getInspection() {
+ return new CloneDeclaresCloneNotSupportedInspection();
}
}
\ No newline at end of file
diff --git a/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java b/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java
index 338c8a73880e..f40b3245891d 100644
--- a/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java
+++ b/plugins/copyright/src/com/maddyhome/idea/copyright/psi/UpdatePsiFileCopyright.java
@@ -159,8 +159,11 @@ public abstract class UpdatePsiFileCopyright extends AbstractUpdateCopyright {
return; // Nothing to do since the comment is the same
}
PsiElement next = getNextSibling(range.getLast());
- if (next instanceof PsiWhiteSpace && countNewline(next.getText()) > 1) {
- return;
+ if (next != null) {
+ final String text = next.getText();
+ if (StringUtil.isEmptyOrSpaces(text) && countNewline(text) > 1) {
+ return;
+ }
}
point = range.getFirst();
}
diff --git a/plugins/git4idea/src/git4idea/history/wholeTree/SelectRevisionInGitLogAction.java b/plugins/git4idea/src/git4idea/history/wholeTree/SelectRevisionInGitLogAction.java
index 1d7db804019b..0d4c66a44f8e 100644
--- a/plugins/git4idea/src/git4idea/history/wholeTree/SelectRevisionInGitLogAction.java
+++ b/plugins/git4idea/src/git4idea/history/wholeTree/SelectRevisionInGitLogAction.java
@@ -2,6 +2,11 @@ package git4idea.history.wholeTree;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
+import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.progress.PerformInBackgroundOption;
+import com.intellij.openapi.progress.ProgressIndicator;
+import com.intellij.openapi.progress.ProgressManager;
+import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
@@ -22,7 +27,12 @@ import git4idea.i18n.GitBundle;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
public class SelectRevisionInGitLogAction extends DumbAwareAction {
+ private static final Logger LOG = Logger.getInstance(SelectRevisionInGitLogAction.class);
public SelectRevisionInGitLogAction() {
super(GitBundle.getString("vcs.history.action.gitlog"), GitBundle.getString("vcs.history.action.gitlog"), null);
@@ -30,7 +40,7 @@ public class SelectRevisionInGitLogAction extends DumbAwareAction {
@Override
public void actionPerformed(@NotNull AnActionEvent event) {
- Project project = event.getRequiredData(CommonDataKeys.PROJECT);
+ final Project project = event.getRequiredData(CommonDataKeys.PROJECT);
final VcsRevisionNumber revision = getRevisionNumber(event);
if (revision == null) {
return;
@@ -60,7 +70,7 @@ public class SelectRevisionInGitLogAction extends DumbAwareAction {
Runnable selectCommit = new Runnable() {
@Override
public void run() {
- log.jumpToReference(revision.asString());
+ jumpToRevisionUnderProgress(project, log, revision);
}
};
@@ -128,5 +138,25 @@ public class SelectRevisionInGitLogAction extends DumbAwareAction {
return null;
}
-
+ private static void jumpToRevisionUnderProgress(@NotNull Project project, @NotNull VcsLog log, @NotNull VcsRevisionNumber revision) {
+ final Future future = log.jumpToReference(revision.asString());
+ if (!future.isDone()) {
+ ProgressManager.getInstance().run(new Task.Backgroundable(project, "Searching for revision " + revision.asString(), false/*can not cancel*/,
+ PerformInBackgroundOption.ALWAYS_BACKGROUND) {
+ @Override
+ public void run(@NotNull ProgressIndicator indicator) {
+ try {
+ future.get();
+ }
+ catch (CancellationException ignored) {
+ }
+ catch (InterruptedException ignored) {
+ }
+ catch (ExecutionException e) {
+ LOG.error(e);
+ }
+ }
+ });
+ }
+ }
}
diff --git a/plugins/hg4idea/testSrc/hg4idea/test/HgEncodingTest.java b/plugins/hg4idea/testSrc/hg4idea/test/HgEncodingTest.java
index 009f90c9a58a..cfc649cd6913 100644
--- a/plugins/hg4idea/testSrc/hg4idea/test/HgEncodingTest.java
+++ b/plugins/hg4idea/testSrc/hg4idea/test/HgEncodingTest.java
@@ -24,7 +24,9 @@ import org.zmlx.hg4idea.command.HgLogCommand;
import org.zmlx.hg4idea.execution.HgCommandException;
import org.zmlx.hg4idea.repo.HgRepository;
import org.zmlx.hg4idea.repo.HgRepositoryImpl;
+import org.zmlx.hg4idea.util.HgEncodingUtil;
+import java.nio.charset.Charset;
import java.util.List;
import static com.intellij.openapi.vcs.Executor.cd;
@@ -49,6 +51,7 @@ public class HgEncodingTest extends HgPlatformTest {
cd(myRepository);
String fileName = "file.txt";
echo(fileName, "lalala");
+ Charset charset = HgEncodingUtil.getDefaultCharset(myProject);
String comment = "öäüß";
HgRepository hgRepo = HgRepositoryImpl.getInstance(myRepository, myProject, myProject);
HgCommitCommand commitCommand = new HgCommitCommand(myProject, hgRepo, comment);
@@ -59,6 +62,6 @@ public class HgEncodingTest extends HgPlatformTest {
assert file != null;
List revisions = logCommand.execute(new HgFile(myProject, file), 1, false);
HgFileRevision rev = revisions.get(0);
- assertEquals(comment, rev.getCommitMessage());
+ assertEquals(new String(comment.getBytes(charset)), rev.getCommitMessage());
}
}
diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java
index 55d4f5d83819..553ad84c1fee 100644
--- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java
+++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/code/interpreter/InstructionImpact.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -19,6 +19,7 @@ import org.jetbrains.java.decompiler.code.CodeConstants;
import org.jetbrains.java.decompiler.code.Instruction;
import org.jetbrains.java.decompiler.struct.consts.ConstantPool;
import org.jetbrains.java.decompiler.struct.consts.LinkConstant;
+import org.jetbrains.java.decompiler.struct.consts.PooledConstant;
import org.jetbrains.java.decompiler.struct.consts.PrimitiveConstant;
import org.jetbrains.java.decompiler.struct.gen.DataPoint;
import org.jetbrains.java.decompiler.struct.gen.MethodDescriptor;
@@ -394,8 +395,8 @@ public class InstructionImpact {
case CodeConstants.opc_ldc:
case CodeConstants.opc_ldc_w:
case CodeConstants.opc_ldc2_w:
- cn = pool.getPrimitiveConstant(instr.getOperand(0));
- switch (cn.type) {
+ PooledConstant constant = pool.getConstant(instr.getOperand(0));
+ switch (constant.type) {
case CodeConstants.CONSTANT_Integer:
stack.push(new VarType(CodeConstants.TYPE_INT));
break;
@@ -416,6 +417,9 @@ public class InstructionImpact {
case CodeConstants.CONSTANT_Class:
stack.push(new VarType(CodeConstants.TYPE_OBJECT, 0, "java/lang/Class"));
break;
+ case CodeConstants.CONSTANT_MethodHandle:
+ stack.push(new VarType(((LinkConstant)constant).descriptor));
+ break;
}
break;
case CodeConstants.opc_aload:
diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java
index c7dd8ca1c173..233011df296a 100644
--- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java
+++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/code/DeadCodeHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -416,6 +416,7 @@ public class DeadCodeHelper {
if (sameRanges) {
seq.addSequence(next.getSeq());
+ block.getInstrOldOffsets().addAll(next.getInstrOldOffsets());
next.getSeq().clear();
removeEmptyBlock(graph, next, true);
diff --git a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
index fbd579b4a480..292d865d44f7 100644
--- a/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
+++ b/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/ExprProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2014 JetBrains s.r.o.
+ * Copyright 2000-2015 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.
@@ -362,8 +362,14 @@ public class ExprProcessor implements CodeConstants {
case opc_ldc:
case opc_ldc_w:
case opc_ldc2_w:
- PrimitiveConstant cn = pool.getPrimitiveConstant(instr.getOperand(0));
- pushEx(stack, exprlist, new ConstExprent(consts[cn.type - CONSTANT_Integer], cn.value, bytecode_offsets));
+ PooledConstant cn = pool.getConstant(instr.getOperand(0));
+ if (cn instanceof PrimitiveConstant) {
+ pushEx(stack, exprlist, new ConstExprent(consts[cn.type - CONSTANT_Integer], ((PrimitiveConstant)cn).value, bytecode_offsets));
+ }
+ else if (cn instanceof LinkConstant) {
+ //TODO: for now treat Links as Strings
+ pushEx(stack, exprlist, new ConstExprent(VarType.VARTYPE_STRING, ((LinkConstant)cn).elementname , bytecode_offsets));
+ }
break;
case opc_iload:
case opc_lload:
diff --git a/plugins/java-decompiler/engine/testData/results/TestClassLoop.dec b/plugins/java-decompiler/engine/testData/results/TestClassLoop.dec
index 5384a981e0f3..f3bf0e07304d 100644
--- a/plugins/java-decompiler/engine/testData/results/TestClassLoop.dec
+++ b/plugins/java-decompiler/engine/testData/results/TestClassLoop.dec
@@ -16,7 +16,7 @@ public class TestClassLoop {
return;
}
} finally {
- System.out.println("1");
+ System.out.println("1");// 38
}
}
}
@@ -30,7 +30,7 @@ public class TestClassLoop {
System.out.println("1");// 49
break;
} finally {
- if(var0) {
+ if(var0) {// 52
System.out.println("3");// 53
continue;
}
@@ -54,6 +54,9 @@ class 'pkg/TestClassLoop' {
4 10
d 10
f 14
+ 26 18
+ 27 18
+ 2a 18
}
method 'testFinallyContinue ()V' {
@@ -64,6 +67,7 @@ class 'pkg/TestClassLoop' {
e 29
11 29
13 29
+ 26 32
2a 33
2d 33
2f 33
@@ -74,6 +78,8 @@ Lines mapping:
23 <-> 6
29 <-> 11
33 <-> 15
+38 <-> 19
45 <-> 25
49 <-> 30
+52 <-> 33
53 <-> 34
diff --git a/plugins/java-decompiler/engine/testData/results/TestClassSimpleBytecodeMapping.dec b/plugins/java-decompiler/engine/testData/results/TestClassSimpleBytecodeMapping.dec
index 291151311a18..b6b6bba690cb 100644
--- a/plugins/java-decompiler/engine/testData/results/TestClassSimpleBytecodeMapping.dec
+++ b/plugins/java-decompiler/engine/testData/results/TestClassSimpleBytecodeMapping.dec
@@ -22,9 +22,9 @@ public class TestClassSimpleBytecodeMapping {
try {
Integer.parseInt(var1);// 34
} catch (Exception var6) {
- System.out.println(var6);
+ System.out.println(var6);// 36
} finally {
- System.out.println("Finally");
+ System.out.println("Finally");// 38
}
}
@@ -80,6 +80,11 @@ class 'pkg/TestClassSimpleBytecodeMapping' {
method 'test2 (Ljava/lang/String;)V' {
1 22
+ 11 24
+ 15 24
+ 23 26
+ 24 26
+ 27 26
}
method 'run (Ljava/lang/Runnable;)V' {
@@ -114,6 +119,8 @@ Lines mapping:
27 <-> 16
28 <-> 17
34 <-> 23
+36 <-> 25
+38 <-> 27
44 <-> 44
49 <-> 33
54 <-> 38
diff --git a/plugins/java-decompiler/engine/testData/results/TestClassVar.dec b/plugins/java-decompiler/engine/testData/results/TestClassVar.dec
index 14d2e070393d..cedd9c0d80a0 100644
--- a/plugins/java-decompiler/engine/testData/results/TestClassVar.dec
+++ b/plugins/java-decompiler/engine/testData/results/TestClassVar.dec
@@ -9,7 +9,7 @@ public class TestClassVar {
try {
System.out.println();// 29
} finally {
- if(this.field_boolean) {
+ if(this.field_boolean) {// 32
System.out.println();// 33
}
@@ -46,6 +46,8 @@ class 'pkg/TestClassVar' {
3 7
8 9
b 9
+ 1f 11
+ 20 11
26 12
29 12
}
@@ -73,6 +75,7 @@ class 'pkg/TestClassVar' {
Lines mapping:
26 <-> 8
29 <-> 10
+32 <-> 12
33 <-> 13
40 <-> 22
45 <-> 26
diff --git a/plugins/java-decompiler/engine/testData/results/TestSynchronizedMapping.dec b/plugins/java-decompiler/engine/testData/results/TestSynchronizedMapping.dec
index ca38d8c0e732..6ba9f3352815 100644
--- a/plugins/java-decompiler/engine/testData/results/TestSynchronizedMapping.dec
+++ b/plugins/java-decompiler/engine/testData/results/TestSynchronizedMapping.dec
@@ -16,6 +16,7 @@ class 'pkg/TestSynchronizedMapping' {
method 'test (I)I' {
3 4
5 5
+ a 5
}
method 'test2 (Ljava/lang/String;)V' {
diff --git a/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec b/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec
index 673238ec14fb..2dc71a58633f 100644
--- a/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec
+++ b/plugins/java-decompiler/engine/testData/results/TestTryCatchFinally.dec
@@ -11,7 +11,7 @@ public class TestTryCatchFinally {
;
}
} finally {
- System.out.println("finally");
+ System.out.println("finally");// 34
}
}
@@ -31,9 +31,9 @@ public class TestTryCatchFinally {
int var2 = Integer.parseInt(var1);// 51
return var2;
} catch (Exception var6) {
- System.out.println("Error" + var6);
+ System.out.println("Error" + var6);// 53
} finally {
- System.out.println("Finally");
+ System.out.println("Finally");// 55
}
return -1;
@@ -48,6 +48,9 @@ class 'pkg/TestTryCatchFinally' {
14 8
17 8
19 8
+ 2b 13
+ 2d 13
+ 30 13
}
method 'foo (I)I' {
@@ -63,15 +66,25 @@ class 'pkg/TestTryCatchFinally' {
method 'test (Ljava/lang/String;)I' {
1 30
4 30
+ 10 33
+ 1a 33
+ 23 33
+ 26 33
+ 34 35
+ 35 35
+ 38 35
}
}
Lines mapping:
24 <-> 6
27 <-> 9
+34 <-> 14
39 <-> 20
40 <-> 21
41 <-> 22
42 <-> 23
45 <-> 25
51 <-> 31
+53 <-> 34
+55 <-> 36
diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java
index a7e498e6e18e..9f3dffb9e814 100644
--- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java
+++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java
@@ -142,6 +142,7 @@ public class TestNGConfigurationEditor extends SettingsEditor
-
+
-
-
+
-
+
\ No newline at end of file
diff --git a/python/edu/course-creator-python/resources/META-INF/plugin.xml b/python/edu/course-creator-python/resources/META-INF/plugin.xml
new file mode 100644
index 000000000000..b9148d8f1de2
--- /dev/null
+++ b/python/edu/course-creator-python/resources/META-INF/plugin.xml
@@ -0,0 +1,43 @@
+
+ com.jetbrains.edu.coursecreator.python
+ Course Creator for PyCharm Educational
+ 2.0
+
+
+
+
+
+
+
+
+
+
+ com.intellij.modules.platform
+ com.intellij.modules.python
+ com.jetbrains.edu.coursecreator
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/python/edu/course-creator/resources/fileTemplates/internal/task.answer.ft b/python/edu/course-creator-python/resources/fileTemplates/internal/task.answer.ft
similarity index 100%
rename from python/edu/course-creator/resources/fileTemplates/internal/task.answer.ft
rename to python/edu/course-creator-python/resources/fileTemplates/internal/task.answer.ft
diff --git a/python/edu/course-creator/resources/fileTemplates/internal/task.html.ft b/python/edu/course-creator-python/resources/fileTemplates/internal/task.html.ft
similarity index 100%
rename from python/edu/course-creator/resources/fileTemplates/internal/task.html.ft
rename to python/edu/course-creator-python/resources/fileTemplates/internal/task.html.ft
diff --git a/python/edu/course-creator/resources/fileTemplates/internal/test_helper.py.ft b/python/edu/course-creator-python/resources/fileTemplates/internal/test_helper.py.ft
similarity index 100%
rename from python/edu/course-creator/resources/fileTemplates/internal/test_helper.py.ft
rename to python/edu/course-creator-python/resources/fileTemplates/internal/test_helper.py.ft
diff --git a/python/edu/course-creator/resources/fileTemplates/internal/tests.py.ft b/python/edu/course-creator-python/resources/fileTemplates/internal/tests.py.ft
similarity index 100%
rename from python/edu/course-creator/resources/fileTemplates/internal/tests.py.ft
rename to python/edu/course-creator-python/resources/fileTemplates/internal/tests.py.ft
diff --git a/python/edu/course-creator/resources/icons/CourseCreationProjectType.png b/python/edu/course-creator-python/resources/icons/CourseCreationProjectType.png
similarity index 100%
rename from python/edu/course-creator/resources/icons/CourseCreationProjectType.png
rename to python/edu/course-creator-python/resources/icons/CourseCreationProjectType.png
diff --git a/python/edu/course-creator/resources/icons/CourseCreationProjectType@2x.png b/python/edu/course-creator-python/resources/icons/CourseCreationProjectType@2x.png
similarity index 100%
rename from python/edu/course-creator/resources/icons/CourseCreationProjectType@2x.png
rename to python/edu/course-creator-python/resources/icons/CourseCreationProjectType@2x.png
diff --git a/python/edu/course-creator/resources/icons/CourseCreationProjectType@2x_dark.png b/python/edu/course-creator-python/resources/icons/CourseCreationProjectType@2x_dark.png
similarity index 100%
rename from python/edu/course-creator/resources/icons/CourseCreationProjectType@2x_dark.png
rename to python/edu/course-creator-python/resources/icons/CourseCreationProjectType@2x_dark.png
diff --git a/python/edu/course-creator/resources/icons/CourseCreationProjectType_dark.png b/python/edu/course-creator-python/resources/icons/CourseCreationProjectType_dark.png
similarity index 100%
rename from python/edu/course-creator/resources/icons/CourseCreationProjectType_dark.png
rename to python/edu/course-creator-python/resources/icons/CourseCreationProjectType_dark.png
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCAnswerFileTypeFactory.java b/python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCAnswerFileTypeFactory.java
similarity index 79%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCAnswerFileTypeFactory.java
rename to python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCAnswerFileTypeFactory.java
index 7c49b8e61658..4585963375a3 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCAnswerFileTypeFactory.java
+++ b/python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCAnswerFileTypeFactory.java
@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.fileTypes.FileTypeConsumer;
import com.intellij.openapi.fileTypes.FileTypeFactory;
+import com.jetbrains.python.PythonFileType;
import org.jetbrains.annotations.NotNull;
-public class CCAnswerFileTypeFactory extends FileTypeFactory {
+public class PyCCAnswerFileTypeFactory extends FileTypeFactory {
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
- fileTypeConsumer.consume(CCAnswerFileType.INSTANCE, "answer");
+ fileTypeConsumer.consume(PythonFileType.INSTANCE, "answer");
}
}
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectGenerator.java b/python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCProjectGenerator.java
similarity index 53%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectGenerator.java
rename to python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCProjectGenerator.java
index 667134d767b5..0cb33f31733a 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectGenerator.java
+++ b/python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/PyCCProjectGenerator.java
@@ -1,34 +1,24 @@
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.facet.ui.FacetEditorValidator;
import com.intellij.facet.ui.FacetValidatorsManager;
import com.intellij.facet.ui.ValidationResult;
-import com.intellij.ide.fileTemplates.FileTemplate;
-import com.intellij.ide.fileTemplates.FileTemplateManager;
-import com.intellij.ide.fileTemplates.FileTemplateUtil;
-import com.intellij.ide.util.DirectoryUtil;
-import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.platform.DirectoryProjectGenerator;
-import com.intellij.psi.PsiDirectory;
-import com.intellij.psi.PsiManager;
+import com.jetbrains.edu.coursecreator.ui.CCNewProjectPanel;
import com.jetbrains.python.newProject.PythonProjectGenerator;
-import icons.CourseCreatorIcons;
+import icons.CourseCreatorPythonIcons;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.actions.CCCreateLesson;
-import org.jetbrains.plugins.coursecreator.actions.CCCreateTask;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.ui.CCNewProjectPanel;
import javax.swing.*;
-public class CCProjectGenerator extends PythonProjectGenerator implements DirectoryProjectGenerator {
+public class PyCCProjectGenerator extends PythonProjectGenerator implements DirectoryProjectGenerator {
private CCNewProjectPanel mySettingsPanel;
@Nls
@@ -47,34 +37,15 @@ public class CCProjectGenerator extends PythonProjectGenerator implements Direct
@Nullable
@Override
public Icon getLogo() {
- return CourseCreatorIcons.CourseCreationProjectType;
+ return CourseCreatorPythonIcons.CourseCreationProjectType;
}
@Override
public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
@Nullable Object settings, @NotNull Module module) {
-
- final CCProjectService service = CCProjectService.getInstance(project);
- final Course course = new Course(mySettingsPanel.getName(), mySettingsPanel.getAuthor(), mySettingsPanel.getDescription());
- service.setCourse(course);
-
- final PsiDirectory projectDir = PsiManager.getInstance(project).findDirectory(baseDir);
- if (projectDir == null) return;
- new WriteCommandAction.Simple(project) {
- @Override
- protected void run() throws Throwable {
- final FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate("test_helper");
- try {
- FileTemplateUtil.createFromTemplate(template, "test_helper.py", null, projectDir);
- }
- catch (Exception ignored) {
- }
- DirectoryUtil.createSubdirectories("hints", projectDir, "\\/");
- final PsiDirectory lessonDir = CCCreateLesson.createLesson(projectDir, 1, null, null, course);
- CCCreateTask.createTask(null, project, lessonDir, false);
- }
- }.execute();
+ CCProjectGeneratorUtil.generateProject(project, baseDir, mySettingsPanel.getName(),
+ mySettingsPanel.getAuthor(), mySettingsPanel.getDescription());
}
@NotNull
diff --git a/python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/actions/PyCCRunTestsAction.java b/python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/actions/PyCCRunTestsAction.java
new file mode 100644
index 000000000000..ee002b64c45a
--- /dev/null
+++ b/python/edu/course-creator-python/src/com/jetbrains/edu/coursecreator/actions/PyCCRunTestsAction.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2000-2014 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 com.jetbrains.edu.coursecreator.actions;
+
+import com.intellij.execution.Executor;
+import com.intellij.execution.ProgramRunnerUtil;
+import com.intellij.execution.RunManager;
+import com.intellij.execution.RunnerAndConfigurationSettings;
+import com.intellij.execution.configurations.ConfigurationFactory;
+import com.intellij.execution.executors.DefaultRunExecutor;
+import com.intellij.ide.projectView.ProjectView;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileManager;
+import com.intellij.util.PathUtil;
+import com.jetbrains.python.run.PythonConfigurationType;
+import com.jetbrains.python.run.PythonRunConfiguration;
+import org.jetbrains.annotations.NotNull;
+
+public class PyCCRunTestsAction extends CCRunTestsAction {
+
+ @Override
+ protected void executeTests(@NotNull final Project project,
+ @NotNull final VirtualFile virtualFile,
+ @NotNull final VirtualFile taskDir,
+ @NotNull final VirtualFile testFile) {
+ final ConfigurationFactory factory = PythonConfigurationType.getInstance().getConfigurationFactories()[0];
+ final RunnerAndConfigurationSettings settings =
+ RunManager.getInstance(project).createRunConfiguration("test", factory);
+
+ final PythonRunConfiguration configuration = (PythonRunConfiguration)settings.getConfiguration();
+ configuration.setScriptName(testFile.getPath());
+ VirtualFile userFile = taskDir.findChild(virtualFile.getNameWithoutExtension() + ".py");
+ if (userFile == null) {
+ return;
+ }
+ VirtualFile ideaDir = project.getBaseDir().findChild(".idea");
+ if (ideaDir == null) {
+ return;
+ }
+ VirtualFileManager.getInstance().refreshWithoutFileWatcher(true);
+ ProjectView.getInstance(project).refresh();
+ VirtualFile courseDir = ideaDir.findChild("course");
+ if (courseDir == null) {
+ return;
+ }
+ configuration.setScriptParameters(PathUtil.toSystemDependentName(courseDir.getPath()) + " " + PathUtil.toSystemDependentName(userFile.getPath()));
+ Executor executor = DefaultRunExecutor.getRunExecutorInstance();
+ ProgramRunnerUtil.executeConfiguration(project, settings, executor);
+ }
+
+
+}
diff --git a/python/edu/course-creator/src/icons/CourseCreatorIcons.java b/python/edu/course-creator-python/src/icons/CourseCreatorPythonIcons.java
similarity index 67%
rename from python/edu/course-creator/src/icons/CourseCreatorIcons.java
rename to python/edu/course-creator-python/src/icons/CourseCreatorPythonIcons.java
index 191ce0d55b30..2342897dc53e 100644
--- a/python/edu/course-creator/src/icons/CourseCreatorIcons.java
+++ b/python/edu/course-creator-python/src/icons/CourseCreatorPythonIcons.java
@@ -8,11 +8,10 @@ import javax.swing.*;
* NOTE THIS FILE IS AUTO-GENERATED
* DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
*/
-public class CourseCreatorIcons {
+public class CourseCreatorPythonIcons {
private static Icon load(String path) {
- return IconLoader.getIcon(path, CourseCreatorIcons.class);
+ return IconLoader.getIcon(path, CourseCreatorPythonIcons.class);
}
public static final Icon CourseCreationProjectType = load("/icons/CourseCreationProjectType.png"); // 32x32
- public static final Icon Gutter = load("/icons/gutter.png"); // 16x16
}
diff --git a/python/edu/course-creator/testData/helloworld.py b/python/edu/course-creator-python/testData/helloworld.py
similarity index 100%
rename from python/edu/course-creator/testData/helloworld.py
rename to python/edu/course-creator-python/testData/helloworld.py
diff --git a/python/edu/course-creator/testData/helloworld.xml b/python/edu/course-creator-python/testData/helloworld.xml
similarity index 100%
rename from python/edu/course-creator/testData/helloworld.xml
rename to python/edu/course-creator-python/testData/helloworld.xml
diff --git a/python/edu/course-creator/tests/CCDocumentListenerTest.java b/python/edu/course-creator-python/tests/CCDocumentListenerTest.java
similarity index 93%
rename from python/edu/course-creator/tests/CCDocumentListenerTest.java
rename to python/edu/course-creator-python/tests/CCDocumentListenerTest.java
index 24e9e85bf1ca..b489513d2123 100644
--- a/python/edu/course-creator/tests/CCDocumentListenerTest.java
+++ b/python/edu/course-creator-python/tests/CCDocumentListenerTest.java
@@ -5,11 +5,11 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.intellij.util.xmlb.XmlSerializer;
+import com.jetbrains.edu.coursecreator.actions.CCCreateCourseArchive;
+import com.jetbrains.edu.coursecreator.format.TaskFile;
+import com.jetbrains.edu.coursecreator.format.TaskWindow;
import org.jdom.input.SAXBuilder;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.actions.CCCreateCourseArchive;
-import org.jetbrains.plugins.coursecreator.format.TaskFile;
-import org.jetbrains.plugins.coursecreator.format.TaskWindow;
import java.util.List;
diff --git a/python/edu/course-creator/tests/CCTestCase.java b/python/edu/course-creator-python/tests/CCTestCase.java
similarity index 96%
rename from python/edu/course-creator/tests/CCTestCase.java
rename to python/edu/course-creator-python/tests/CCTestCase.java
index c7dbe46308c9..66c33ebf859b 100644
--- a/python/edu/course-creator/tests/CCTestCase.java
+++ b/python/edu/course-creator-python/tests/CCTestCase.java
@@ -25,7 +25,7 @@ public abstract class CCTestCase extends UsefulTestCase {
}
protected String getTestDataPath() {
- return PythonHelpersLocator.getPythonCommunityPath() + "/edu/course-creator/testData";
+ return PythonHelpersLocator.getPythonCommunityPath() + "/educational_python/course_creator_python/testData";
}
@Override
diff --git a/python/edu/course-creator/resources/META-INF/plugin.xml b/python/edu/course-creator/resources/META-INF/plugin.xml
deleted file mode 100644
index 0e7391d1a18b..000000000000
--- a/python/edu/course-creator/resources/META-INF/plugin.xml
+++ /dev/null
@@ -1,86 +0,0 @@
-
- org.jetbrains.plugins.coursecreator
- Course Creator for PyCharm Educational
- 1.2
-
-
-
-
-
-
-
-
-
-
- com.intellij.modules.python
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.jetbrains.plugins.coursecreator.CCProjectComponent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/python/edu/course-creator/resources/icons/gutter.png b/python/edu/course-creator/resources/icons/gutter.png
deleted file mode 100644
index 244e6ca045c5..000000000000
Binary files a/python/edu/course-creator/resources/icons/gutter.png and /dev/null differ
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCRunTests.java b/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCRunTests.java
deleted file mode 100644
index cf1f7e48ea3d..000000000000
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCRunTests.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2000-2014 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.plugins.coursecreator;
-
-import com.intellij.openapi.actionSystem.AnAction;
-import com.jetbrains.python.edu.PyExecuteFileExtensionPoint;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.actions.CCRunTestsAction;
-
-public class CCRunTests implements PyExecuteFileExtensionPoint {
-
- @NotNull
- public AnAction getRunAction() {
- return new CCRunTestsAction();
- }
-
-}
diff --git a/python/edu/learn-python/learn-python.iml b/python/edu/interactive-learning-python/interactive-learning-python.iml
similarity index 74%
rename from python/edu/learn-python/learn-python.iml
rename to python/edu/interactive-learning-python/interactive-learning-python.iml
index f2b46e9e5479..96fc1b873f54 100644
--- a/python/edu/learn-python/learn-python.iml
+++ b/python/edu/interactive-learning-python/interactive-learning-python.iml
@@ -4,18 +4,26 @@
-
-
+
-
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/python/edu/interactive-learning-python/resources/META-INF/plugin.xml b/python/edu/interactive-learning-python/resources/META-INF/plugin.xml
new file mode 100644
index 000000000000..be0490b7ba79
--- /dev/null
+++ b/python/edu/interactive-learning-python/resources/META-INF/plugin.xml
@@ -0,0 +1,43 @@
+
+
+ com.jetbrains.python.edu.interactivelearning.python
+ Educational plugin for PyCharm
+ 2.0
+
+
+
+
+
+
+
+
+
+
+ com.intellij.modules.lang
+ com.intellij.modules.python
+ com.jetbrains.edu.interactivelearning
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/python/edu/learn-python/resources/com/jetbrains/python/edu/user_tester.py b/python/edu/interactive-learning-python/resources/com/jetbrains/python/edu/user_tester.py
similarity index 100%
rename from python/edu/learn-python/resources/com/jetbrains/python/edu/user_tester.py
rename to python/edu/interactive-learning-python/resources/com/jetbrains/python/edu/user_tester.py
diff --git a/python/edu/learn-python/resources/courses/introduction_course.zip b/python/edu/interactive-learning-python/resources/courses/introduction_course.zip
similarity index 100%
rename from python/edu/learn-python/resources/courses/introduction_course.zip
rename to python/edu/interactive-learning-python/resources/courses/introduction_course.zip
diff --git a/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType.png b/python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType.png
similarity index 100%
rename from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType.png
rename to python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType.png
diff --git a/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType@2x.png b/python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType@2x.png
similarity index 100%
rename from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType@2x.png
rename to python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType@2x.png
diff --git a/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType_dark.png b/python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType_dark.png
similarity index 100%
rename from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType_dark.png
rename to python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType_dark.png
diff --git a/python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType_dark@2x.png b/python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType_dark@2x.png
similarity index 100%
rename from python/edu/learn-python/resources/icons/com/jetbrains/python/edu/EducationalProjectType_dark@2x.png
rename to python/edu/interactive-learning-python/resources/icons/com/jetbrains/edu/learning/EducationalProjectType_dark@2x.png
diff --git a/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java
new file mode 100644
index 000000000000..293282be29e3
--- /dev/null
+++ b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyDirectoryProjectGenerator.java
@@ -0,0 +1,95 @@
+package com.jetbrains.edu.learning;
+
+import com.intellij.facet.ui.FacetEditorValidator;
+import com.intellij.facet.ui.FacetValidatorsManager;
+import com.intellij.facet.ui.ValidationResult;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.progress.ProcessCanceledException;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.platform.DirectoryProjectGenerator;
+import com.jetbrains.edu.learning.course.CourseInfo;
+import com.jetbrains.edu.learning.ui.StudyNewProjectPanel;
+import com.jetbrains.python.newProject.PythonProjectGenerator;
+import icons.InteractiveLearningPythonIcons;
+import org.jetbrains.annotations.Nls;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import javax.swing.*;
+import java.io.File;
+import java.util.Map;
+
+
+public class PyStudyDirectoryProjectGenerator extends PythonProjectGenerator implements DirectoryProjectGenerator {
+ private final StudyProjectGenerator myGenerator;
+ public ValidationResult myValidationResult = new ValidationResult("selected course is not valid");
+
+ public PyStudyDirectoryProjectGenerator() {
+ myGenerator = new StudyProjectGenerator();
+ myGenerator.addSettingsStateListener(new StudyProjectGenerator.SettingsListener() {
+ @Override
+ public void stateChanged(ValidationResult result) {
+ setValidationResult(result);
+ }
+ });
+ }
+
+ @Nls
+ @NotNull
+ @Override
+ public String getName() {
+ return "Educational";
+ }
+
+ @Nullable
+ @Override
+ public Object showGenerationSettings(VirtualFile baseDir) throws ProcessCanceledException {
+ return null;
+ }
+
+ @Nullable
+ @Override
+ public Icon getLogo() {
+ return InteractiveLearningPythonIcons.EducationalProjectType;
+ }
+
+
+ @Override
+ public void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
+ @Nullable Object settings, @NotNull Module module) {
+ myGenerator.generateProject(project, baseDir);
+ }
+ @NotNull
+ @Override
+ public ValidationResult validate(@NotNull String s) {
+ return myValidationResult;
+ }
+
+ public void setValidationResult(ValidationResult validationResult) {
+ myValidationResult = validationResult;
+ }
+
+ @Nullable
+ @Override
+ public JPanel extendBasePanel() throws ProcessCanceledException {
+ StudyNewProjectPanel settingsPanel = new StudyNewProjectPanel(myGenerator);
+ settingsPanel.registerValidators(new FacetValidatorsManager() {
+ public void registerValidator(FacetEditorValidator validator, JComponent... componentsToWatch) {
+ throw new UnsupportedOperationException();
+ }
+ public void validate() {
+ fireStateChanged();
+ }
+ });
+ return settingsPanel.getContentPanel();
+ }
+
+ public Map getCourses() {
+ return myGenerator.getCourses();
+ }
+
+ public void setSelectedCourse(CourseInfo course) {
+ myGenerator.setSelectedCourse(course);
+ }
+}
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyTestRunner.java b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyTestRunner.java
similarity index 62%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/StudyTestRunner.java
rename to python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyTestRunner.java
index 78eadcbfe8b2..bc0e563d80c9 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyTestRunner.java
+++ b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyTestRunner.java
@@ -1,36 +1,26 @@
-package com.jetbrains.python.edu;
+package com.jetbrains.edu.learning;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
-import com.intellij.execution.process.ProcessOutput;
-import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
-import com.jetbrains.python.edu.course.Course;
-import com.jetbrains.python.edu.course.Task;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.edu.learning.course.Task;
import com.jetbrains.python.sdk.PythonSdkType;
import org.jetbrains.annotations.NotNull;
-import java.io.*;
+import java.io.File;
import java.util.Map;
-public class StudyTestRunner {
- public static final String STUDY_PREFIX="#educational_plugin";
- public static final String TEST_OK = "test OK";
- private static final String TEST_FAILED = "FAILED + ";
+public class PyStudyTestRunner extends StudyTestRunner {
private static final String PYTHONPATH = "PYTHONPATH";
- private static final Logger LOG = Logger.getInstance(StudyTestRunner.class);
- private final Task myTask;
- private final VirtualFile myTaskDir;
- public StudyTestRunner(Task task, VirtualFile taskDir) {
- myTask = task;
- myTaskDir = taskDir;
+ PyStudyTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskfile) {
+ super(task, taskfile);
}
-
public Process createCheckProcess(Project project, String executablePath) throws ExecutionException {
Sdk sdk = PythonSdkType.findPythonSdk(ModuleManager.getInstance(project).getModules()[0]);
File testRunner = new File(myTaskDir.getPath(), myTask.getTestFile());
@@ -61,20 +51,4 @@ public class StudyTestRunner {
}
return null;
}
-
-
- @NotNull
- public String getTestsOutput(@NotNull final ProcessOutput processOutput) {
- for (String line : processOutput.getStdoutLines()) {
- if (line.contains(STUDY_PREFIX)) {
- if (line.contains(TEST_OK)) {
- continue;
- }
- int messageStart = line.indexOf(TEST_FAILED);
- return line.substring(messageStart + TEST_FAILED.length());
- }
- }
-
- return TEST_OK;
- }
}
diff --git a/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyUtils.java b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyUtils.java
new file mode 100644
index 000000000000..524510e97e6c
--- /dev/null
+++ b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/PyStudyUtils.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2000-2014 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 com.jetbrains.edu.learning;
+
+import com.intellij.execution.RunContentExecutor;
+import com.intellij.execution.configurations.GeneralCommandLine;
+import com.intellij.execution.process.ProcessHandler;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.projectRoots.Sdk;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.jetbrains.edu.learning.course.Task;
+import com.jetbrains.python.run.PythonTracebackFilter;
+import com.jetbrains.python.sdk.PythonSdkType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.io.File;
+
+public class PyStudyUtils implements StudyUtilsExtensionPoint {
+
+ @Override
+ public Sdk findSdk(@NotNull final Project project) {
+ return PythonSdkType.findPythonSdk(ModuleManager.getInstance(project).getModules()[0]);
+ }
+
+ @Nullable
+ @Override
+ public String getLinkToTutorial() {
+ return "If you'd like to learn" +
+ " more about PyCharm " +
+ "Educational Edition, " +
+ "click here to watch a tutorial";
+ }
+
+ @Override
+ public StudyTestRunner getTestRunner(@NotNull final Task task, @NotNull final VirtualFile taskDir) {
+ return new PyStudyTestRunner(task, taskDir);
+ }
+
+ @Override
+ public RunContentExecutor getExecutor(@NotNull final Project project, @NotNull final ProcessHandler handler) {
+ return new RunContentExecutor(project, handler).withFilter(new PythonTracebackFilter(project));
+ }
+
+ @Override
+ public void setCommandLineParameters(@NotNull final GeneralCommandLine cmd,
+ @NotNull final Project project,
+ @NotNull final String filePath,
+ @NotNull final String pythonPath,
+ @NotNull final Task currentTask) {
+ if (!currentTask.getUserTests().isEmpty()) {
+ cmd.addParameter(new File(project.getBaseDir().getPath(), StudyNames.USER_TESTER).getPath());
+ cmd.addParameter(pythonPath);
+ cmd.addParameter(filePath);
+ }
+ else {
+ cmd.addParameter(filePath);
+ }
+ }
+
+
+}
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyIntroductionCourseAction.java b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyIntroductionCourseAction.java
similarity index 81%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyIntroductionCourseAction.java
rename to python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyIntroductionCourseAction.java
index a03dc6acec3b..a7785e16838c 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyIntroductionCourseAction.java
+++ b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyIntroductionCourseAction.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
import com.intellij.ide.impl.ProjectUtil;
import com.intellij.openapi.actionSystem.AnAction;
@@ -21,23 +21,23 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.projectRoots.Sdk;
+import com.jetbrains.edu.learning.PyStudyDirectoryProjectGenerator;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.CourseInfo;
import com.jetbrains.python.configuration.PyConfigurableInterpreterList;
-import com.jetbrains.python.edu.StudyDirectoryProjectGenerator;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.CourseInfo;
import com.jetbrains.python.newProject.actions.GenerateProjectCallback;
import com.jetbrains.python.newProject.actions.ProjectSpecificSettingsStep;
-import icons.StudyIcons;
+import icons.InteractiveLearningPythonIcons;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.List;
import java.util.Map;
-public class StudyIntroductionCourseAction extends AnAction {
+public class PyStudyIntroductionCourseAction extends AnAction {
- public StudyIntroductionCourseAction() {
- super("Introduction to Python", "Introduction to Python", StudyIcons.EducationalProjectType);
+ public PyStudyIntroductionCourseAction() {
+ super("Introduction to Python", "Introduction to Python", InteractiveLearningPythonIcons.EducationalProjectType);
}
@Override
@@ -48,7 +48,7 @@ public class StudyIntroductionCourseAction extends AnAction {
}
else {
final GenerateProjectCallback callback = new GenerateProjectCallback();
- final StudyDirectoryProjectGenerator generator = new StudyDirectoryProjectGenerator();
+ final PyStudyDirectoryProjectGenerator generator = new PyStudyDirectoryProjectGenerator();
final Map courses = generator.getCourses();
CourseInfo introCourse = null;
for (CourseInfo info : courses.keySet()) {
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWatchTutorialAction.java b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyWatchTutorialAction.java
similarity index 74%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWatchTutorialAction.java
rename to python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyWatchTutorialAction.java
index cae18e2457ad..e9e1b2b378bb 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyWatchTutorialAction.java
+++ b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/actions/PyStudyWatchTutorialAction.java
@@ -1,12 +1,12 @@
-package com.jetbrains.python.edu.actions;
+package com.jetbrains.edu.learning.actions;
import com.intellij.ide.BrowserUtil;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import org.jetbrains.annotations.NotNull;
-public class StudyWatchTutorialAction extends DumbAwareAction {
- public StudyWatchTutorialAction() {
+public class PyStudyWatchTutorialAction extends DumbAwareAction {
+ public PyStudyWatchTutorialAction() {
super("Learn more about PyCharm Educational Edition", null, null);
}
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/highlighting/StudyVisitorFilter.java b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/highlighting/PyStudyVisitorFilter.java
similarity index 76%
rename from python/edu/learn-python/src/com/jetbrains/python/edu/highlighting/StudyVisitorFilter.java
rename to python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/highlighting/PyStudyVisitorFilter.java
index dc7495adb16e..4b849da0bf7a 100644
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/highlighting/StudyVisitorFilter.java
+++ b/python/edu/interactive-learning-python/src/com/jetbrains/edu/learning/highlighting/PyStudyVisitorFilter.java
@@ -1,12 +1,12 @@
-package com.jetbrains.python.edu.highlighting;
+package com.jetbrains.edu.learning.highlighting;
import com.intellij.psi.PsiFile;
-import com.jetbrains.python.edu.StudyTaskManager;
+import com.jetbrains.edu.learning.StudyTaskManager;
import com.jetbrains.python.inspections.PythonVisitorFilter;
import com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection;
import org.jetbrains.annotations.NotNull;
-public class StudyVisitorFilter implements PythonVisitorFilter {
+public class PyStudyVisitorFilter implements PythonVisitorFilter {
@Override
public boolean isSupported(@NotNull final Class visitorClass, @NotNull final PsiFile file) {
if (StudyTaskManager.getInstance(file.getProject()).getCourse() == null) return true;
diff --git a/python/edu/interactive-learning-python/src/icons/InteractiveLearningPythonIcons.java b/python/edu/interactive-learning-python/src/icons/InteractiveLearningPythonIcons.java
new file mode 100644
index 000000000000..08b0bdd2acd8
--- /dev/null
+++ b/python/edu/interactive-learning-python/src/icons/InteractiveLearningPythonIcons.java
@@ -0,0 +1,17 @@
+package icons;
+
+import com.intellij.openapi.util.IconLoader;
+
+import javax.swing.*;
+
+/**
+ * NOTE THIS FILE IS AUTO-GENERATED
+ * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
+ */
+public class InteractiveLearningPythonIcons {
+ private static Icon load(String path) {
+ return IconLoader.getIcon(path, InteractiveLearningPythonIcons.class);
+ }
+
+ public static final Icon EducationalProjectType = load("/icons/com/jetbrains/edu/learning/EducationalProjectType.png"); // 16x16
+}
diff --git a/python/edu/learn-python/testData/course.json b/python/edu/interactive-learning-python/testData/course.json
similarity index 100%
rename from python/edu/learn-python/testData/course.json
rename to python/edu/interactive-learning-python/testData/course.json
diff --git a/python/edu/learn-python/testData/helloworld.py b/python/edu/interactive-learning-python/testData/helloworld.py
similarity index 100%
rename from python/edu/learn-python/testData/helloworld.py
rename to python/edu/interactive-learning-python/testData/helloworld.py
diff --git a/python/edu/learn-python/tests/JsonParserTest.java b/python/edu/interactive-learning-python/tests/JsonParserTest.java
similarity index 63%
rename from python/edu/learn-python/tests/JsonParserTest.java
rename to python/edu/interactive-learning-python/tests/JsonParserTest.java
index df8ee03a6c39..b9fd9654a90e 100644
--- a/python/edu/learn-python/tests/JsonParserTest.java
+++ b/python/edu/interactive-learning-python/tests/JsonParserTest.java
@@ -1,32 +1,30 @@
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import org.junit.Before;
-import org.junit.Test;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.Course;
+import com.jetbrains.edu.learning.StudyUtils;
+import com.jetbrains.edu.learning.course.Course;
+import com.jetbrains.python.PythonHelpersLocator;
+import junit.framework.TestCase;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.io.Reader;
-import static org.junit.Assert.assertEquals;
/**
* author: liana
* data: 7/4/14.
*/
-public class JsonParserTest {
+public class JsonParserTest extends TestCase {
private Course myCourse = null;
- @Before
- public void setUp() throws FileNotFoundException {
- Reader reader = new InputStreamReader(new FileInputStream("testData/course.json"));
+
+ public void setUp() throws Exception {
+ super.setUp();
+ Reader reader = new InputStreamReader(new FileInputStream(getTestDataPath() + "/course.json"));
Gson gson = new GsonBuilder().setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
myCourse = gson.fromJson(reader, Course.class);
}
- @Test
public void testCourseLevel() {
assertEquals(myCourse.getName(), "Python для начинающих");
assertEquals(StudyUtils.getFirst(myCourse.getLessons().get(1).getTaskList().get(0).getUserTests()).getInput(), "sum-input.txt");
@@ -34,4 +32,7 @@ public class JsonParserTest {
assertEquals(myCourse.getLessons().get(0).getTaskList().size(), 2);
assertEquals(myCourse.getLessons().get(1).getTaskList().size(), 1);
}
+ protected String getTestDataPath() {
+ return PythonHelpersLocator.getPythonCommunityPath() + "/edu/learn-python/testData";
+ }
}
diff --git a/python/edu/learn-python/tests/StudyDocumentListenerTest.java b/python/edu/interactive-learning-python/tests/StudyDocumentListenerTest.java
similarity index 91%
rename from python/edu/learn-python/tests/StudyDocumentListenerTest.java
rename to python/edu/interactive-learning-python/tests/StudyDocumentListenerTest.java
index 9a89d12d670a..1004bd643dd9 100644
--- a/python/edu/learn-python/tests/StudyDocumentListenerTest.java
+++ b/python/edu/interactive-learning-python/tests/StudyDocumentListenerTest.java
@@ -3,9 +3,9 @@ import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.psi.PsiFile;
-import com.jetbrains.python.edu.StudyDocumentListener;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.course.TaskWindow;
+import com.jetbrains.edu.learning.StudyDocumentListener;
+import com.jetbrains.edu.learning.course.TaskFile;
+import com.jetbrains.edu.learning.course.TaskWindow;
import java.util.ArrayList;
import java.util.List;
diff --git a/python/edu/learn-python/tests/StudyTestCase.java b/python/edu/interactive-learning-python/tests/StudyTestCase.java
similarity index 100%
rename from python/edu/learn-python/tests/StudyTestCase.java
rename to python/edu/interactive-learning-python/tests/StudyTestCase.java
diff --git a/python/edu/learn-python/gen/icons/StudyIcons.java b/python/edu/learn-python/gen/icons/StudyIcons.java
deleted file mode 100644
index f1db45d83e73..000000000000
--- a/python/edu/learn-python/gen/icons/StudyIcons.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package icons;
-
-import com.intellij.openapi.util.IconLoader;
-
-import javax.swing.*;
-
-/**
- * NOTE THIS FILE IS AUTO-GENERATED
- * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead
- */
-public class StudyIcons {
- private static Icon load(String path) {
- return IconLoader.getIcon(path, StudyIcons.class);
- }
-
- public static final Icon EducationalProjectType = load("/icons/com/jetbrains/python/edu/EducationalProjectType.png"); // 16x16
- public static final Icon Lesson = load("/icons/com/jetbrains/python/edu/Lesson.png"); // 16x16
- public static final Icon LessonCompl = load("/icons/com/jetbrains/python/edu/LessonCompl.png"); // 16x16
- public static final Icon Prev = load("/icons/com/jetbrains/python/edu/prev.png"); // 16x16
- public static final Icon Resolve = load("/icons/com/jetbrains/python/edu/resolve.png"); // 16x16
- public static final Icon Sandbox = load("/icons/com/jetbrains/python/edu/Sandbox.png"); // 16x16
- public static final Icon ShowHint = load("/icons/com/jetbrains/python/edu/showHint.png"); // 16x16
- public static final Icon Task = load("/icons/com/jetbrains/python/edu/Task.png"); // 16x16
- public static final Icon TaskCompl = load("/icons/com/jetbrains/python/edu/TaskCompl.png"); // 16x16
- public static final Icon TaskProbl = load("/icons/com/jetbrains/python/edu/TaskProbl.png"); // 16x16
- public static final Icon WatchInput = load("/icons/com/jetbrains/python/edu/WatchInput.png"); // 24x24
-}
diff --git a/python/edu/learn-python/resources/META-INF/plugin.xml b/python/edu/learn-python/resources/META-INF/plugin.xml
deleted file mode 100644
index a8e99c9506ec..000000000000
--- a/python/edu/learn-python/resources/META-INF/plugin.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
- com.jetbrains.python.edu.learn-python
- Educational plugin for PyCharm
- 1.2
-
-
-
-
-
-
-
-
-
-
- com.intellij.modules.lang
- com.intellij.modules.python
-
-
-
- com.jetbrains.python.edu.StudyTaskManager
- com.jetbrains.python.edu.StudyTaskManager
-
-
-
-
-
- com.jetbrains.python.edu.StudyInitialConfigurator
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyResourceManger.java b/python/edu/learn-python/src/com/jetbrains/python/edu/StudyResourceManger.java
deleted file mode 100644
index 38f1c2ff2cde..000000000000
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/StudyResourceManger.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.jetbrains.python.edu;
-
-public interface StudyResourceManger {
- String USER_TESTER = "user_tester.py";
-}
diff --git a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRunAction.java b/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRunAction.java
deleted file mode 100644
index c1398a9a585a..000000000000
--- a/python/edu/learn-python/src/com/jetbrains/python/edu/actions/StudyRunAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.jetbrains.python.edu.actions;
-
-import com.intellij.execution.ExecutionException;
-import com.intellij.execution.RunContentExecutor;
-import com.intellij.execution.configurations.GeneralCommandLine;
-import com.intellij.execution.process.OSProcessHandler;
-import com.intellij.execution.process.ProcessHandler;
-import com.intellij.openapi.actionSystem.AnActionEvent;
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.fileEditor.FileDocumentManager;
-import com.intellij.openapi.project.DumbAwareAction;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.Sdk;
-import com.intellij.openapi.util.Disposer;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.jetbrains.python.edu.StudyResourceManger;
-import com.jetbrains.python.edu.StudyTaskManager;
-import com.jetbrains.python.edu.StudyUtils;
-import com.jetbrains.python.edu.course.Task;
-import com.jetbrains.python.edu.course.TaskFile;
-import com.jetbrains.python.edu.editor.StudyEditor;
-import com.jetbrains.python.run.PythonTracebackFilter;
-import org.jetbrains.annotations.NotNull;
-
-import java.io.File;
-
-public class StudyRunAction extends DumbAwareAction {
- private static final Logger LOG = Logger.getInstance(StudyRunAction.class.getName());
- public static final String ACTION_ID = "StudyRunAction";
- private ProcessHandler myHandler;
-
- public void run(@NotNull final Project project, @NotNull final Sdk sdk) {
- if (myHandler != null && !myHandler.isProcessTerminated()) return;
- Editor selectedEditor = StudyEditor.getSelectedEditor(project);
- FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
- assert selectedEditor != null;
- VirtualFile openedFile = fileDocumentManager.getFile(selectedEditor.getDocument());
- StudyTaskManager taskManager = StudyTaskManager.getInstance(project);
- if (openedFile != null && openedFile.getCanonicalPath() != null) {
- String filePath = openedFile.getCanonicalPath();
- GeneralCommandLine cmd = new GeneralCommandLine();
- cmd.withWorkDirectory(openedFile.getParent().getCanonicalPath());
- String pythonPath = sdk.getHomePath();
- if (pythonPath != null) {
- cmd.setExePath(pythonPath);
- TaskFile selectedTaskFile = taskManager.getTaskFile(openedFile);
- assert selectedTaskFile != null;
- Task currentTask = selectedTaskFile.getTask();
- if (!currentTask.getUserTests().isEmpty()) {
- cmd.addParameter(new File(project.getBaseDir().getPath(), StudyResourceManger.USER_TESTER).getPath());
- cmd.addParameter(pythonPath);
- cmd.addParameter(filePath);
- Process process;
- try {
- process = cmd.createProcess();
- }
- catch (ExecutionException e) {
- LOG.error(e);
- return;
- }
- myHandler = new OSProcessHandler(process);
- RunContentExecutor executor = new RunContentExecutor(project, myHandler).withFilter(new PythonTracebackFilter(project));
- Disposer.register(project, executor);
- executor.run();
- return;
- }
- try {
- cmd.addParameter(filePath);
- Process p = cmd.createProcess();
- myHandler = new OSProcessHandler(p);
-
- RunContentExecutor executor = new RunContentExecutor(project, myHandler).withFilter(new PythonTracebackFilter(project));
- Disposer.register(project, executor);
- executor.run();
- }
-
- catch (ExecutionException e) {
- LOG.error(e);
- }
- }
- }
- }
-
- public void actionPerformed(@NotNull AnActionEvent e) {
- Project project = e.getProject();
- if (project == null) {
- return;
- }
- Sdk sdk = StudyUtils.findPythonSdk(project);
- if (sdk == null) {
- return;
- }
- run(project, sdk);
- }
-}
diff --git a/python/edu/main_pycharm_edu.iml b/python/edu/main_pycharm_edu.iml
index 565d236ec4a7..7dbfb712fc9c 100644
--- a/python/edu/main_pycharm_edu.iml
+++ b/python/edu/main_pycharm_edu.iml
@@ -15,9 +15,10 @@
-
+
+
+
-
-
+
\ No newline at end of file
diff --git a/python/educational/course-creator/course-creator.iml b/python/educational/course-creator/course-creator.iml
new file mode 100644
index 000000000000..75a2690f8e0f
--- /dev/null
+++ b/python/educational/course-creator/course-creator.iml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/python/educational/course-creator/resources/META-INF/plugin.xml b/python/educational/course-creator/resources/META-INF/plugin.xml
new file mode 100644
index 000000000000..6fb2817bff05
--- /dev/null
+++ b/python/educational/course-creator/resources/META-INF/plugin.xml
@@ -0,0 +1,78 @@
+
+ com.jetbrains.edu.coursecreator
+ Course Creator Plugin
+ 2.0
+
+
+
+
+
+
+
+
+
+ com.intellij.modules.platform
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ com.jetbrains.edu.coursecreator.CCProjectComponent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCDocumentListener.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCDocumentListener.java
similarity index 94%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCDocumentListener.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCDocumentListener.java
index b1917292df32..e2621bfa0342 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCDocumentListener.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCDocumentListener.java
@@ -1,11 +1,11 @@
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
-import org.jetbrains.plugins.coursecreator.format.TaskFile;
-import org.jetbrains.plugins.coursecreator.format.TaskWindow;
+import com.jetbrains.edu.coursecreator.format.TaskFile;
+import com.jetbrains.edu.coursecreator.format.TaskWindow;
import java.util.ArrayList;
import java.util.List;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCEditorFactoryListener.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCEditorFactoryListener.java
similarity index 93%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCEditorFactoryListener.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCEditorFactoryListener.java
index c61ab10d7332..57d7d73a9fe5 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCEditorFactoryListener.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCEditorFactoryListener.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.openapi.editor.Document;
@@ -12,8 +12,11 @@ import com.intellij.openapi.editor.event.EditorFactoryListener;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Task;
+import com.jetbrains.edu.coursecreator.format.TaskFile;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.format.*;
public class CCEditorFactoryListener implements EditorFactoryListener {
@Override
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectComponent.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectComponent.java
similarity index 95%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectComponent.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectComponent.java
index 88a242492581..e4c44a97e62f 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectComponent.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectComponent.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ProjectComponent;
@@ -16,12 +16,12 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileAdapter;
import com.intellij.openapi.vfs.VirtualFileEvent;
import com.intellij.openapi.vfs.VirtualFileManager;
+import com.jetbrains.edu.coursecreator.actions.CCRunTestsAction;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Task;
+import com.jetbrains.edu.coursecreator.format.TaskFile;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.actions.CCRunTestsAction;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
-import org.jetbrains.plugins.coursecreator.format.Task;
-import org.jetbrains.plugins.coursecreator.format.TaskFile;
import java.io.IOException;
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectGeneratorUtil.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectGeneratorUtil.java
new file mode 100644
index 000000000000..2d7d03f1dc9e
--- /dev/null
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectGeneratorUtil.java
@@ -0,0 +1,48 @@
+package com.jetbrains.edu.coursecreator;
+
+import com.intellij.ide.fileTemplates.FileTemplate;
+import com.intellij.ide.fileTemplates.FileTemplateManager;
+import com.intellij.ide.fileTemplates.FileTemplateUtil;
+import com.intellij.ide.util.DirectoryUtil;
+import com.intellij.openapi.command.WriteCommandAction;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.psi.PsiDirectory;
+import com.intellij.psi.PsiManager;
+import com.jetbrains.edu.coursecreator.actions.CCCreateLesson;
+import com.jetbrains.edu.coursecreator.actions.CCCreateTask;
+import com.jetbrains.edu.coursecreator.format.Course;
+import org.jetbrains.annotations.NotNull;
+
+
+public class CCProjectGeneratorUtil {
+ private CCProjectGeneratorUtil() {
+ }
+
+ public static void generateProject(@NotNull final Project project, @NotNull final VirtualFile baseDir,
+ @NotNull final String name, @NotNull final String author,
+ @NotNull final String description) {
+
+ final CCProjectService service = CCProjectService.getInstance(project);
+ final Course course = new Course(name, author, description);
+ service.setCourse(course);
+
+ final PsiDirectory projectDir = PsiManager.getInstance(project).findDirectory(baseDir);
+ if (projectDir == null) return;
+ new WriteCommandAction.Simple(project) {
+ @Override
+ protected void run() throws Throwable {
+ final FileTemplate template = FileTemplateManager.getInstance(project).getInternalTemplate("test_helper");
+ try {
+ FileTemplateUtil.createFromTemplate(template, "test_helper.py", null, projectDir);
+ }
+ catch (Exception ignored) {
+ }
+ DirectoryUtil.createSubdirectories("hints", projectDir, "\\/");
+ final PsiDirectory lessonDir = CCCreateLesson.createLesson(projectDir, 1, null, null, course);
+ CCCreateTask.createTask(null, project, lessonDir, false);
+ }
+ }.execute();
+ }
+
+}
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectService.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectService.java
similarity index 98%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectService.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectService.java
index 6d56fe6b5962..028e449f6fda 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCProjectService.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectService.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.ide.projectView.ProjectView;
import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -29,10 +29,10 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.xmlb.XmlSerializer;
+import com.jetbrains.edu.coursecreator.format.*;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.format.*;
import java.io.File;
import java.util.Collection;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCRefactoringElementListenerProvider.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCRefactoringElementListenerProvider.java
similarity index 90%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCRefactoringElementListenerProvider.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCRefactoringElementListenerProvider.java
index 9ff6aa77fd44..50a4693d29cc 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCRefactoringElementListenerProvider.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCRefactoringElementListenerProvider.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.psi.PsiDirectory;
@@ -22,13 +22,13 @@ import com.intellij.psi.PsiFile;
import com.intellij.refactoring.listeners.RefactoringElementAdapter;
import com.intellij.refactoring.listeners.RefactoringElementListener;
import com.intellij.refactoring.listeners.RefactoringElementListenerProvider;
+import com.jetbrains.edu.coursecreator.actions.CCRunTestsAction;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Task;
+import com.jetbrains.edu.coursecreator.format.TaskFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.actions.CCRunTestsAction;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
-import org.jetbrains.plugins.coursecreator.format.Task;
-import org.jetbrains.plugins.coursecreator.format.TaskFile;
import java.util.Map;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCUtils.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCUtils.java
similarity index 97%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCUtils.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCUtils.java
index e2cc9d575638..130952e8ebaa 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/CCUtils.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCUtils.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator;
+package com.jetbrains.edu.coursecreator;
import com.intellij.ide.projectView.actions.MarkRootActionBase;
import com.intellij.openapi.application.ApplicationManager;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCAddTaskWindow.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAddTaskWindow.java
similarity index 96%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCAddTaskWindow.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAddTaskWindow.java
index 244de123a33d..17f62ce19ef8 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCAddTaskWindow.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAddTaskWindow.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -13,10 +13,10 @@ import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.*;
+import com.jetbrains.edu.coursecreator.ui.CreateTaskWindowDialog;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.*;
-import org.jetbrains.plugins.coursecreator.ui.CreateTaskWindowDialog;
import java.util.List;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCChangeCourseInfo.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCChangeCourseInfo.java
similarity index 93%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCChangeCourseInfo.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCChangeCourseInfo.java
index 653af6c691f6..81ee890989bb 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCChangeCourseInfo.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCChangeCourseInfo.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.ide.IdeView;
import com.intellij.ide.projectView.ProjectView;
@@ -11,11 +11,11 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.psi.PsiDirectory;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.ui.CCNewProjectPanel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.ui.CCNewProjectPanel;
import javax.swing.*;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateCourseArchive.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
similarity index 97%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateCourseArchive.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
index a3d4f56e2b34..5a2cf63af8cb 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateCourseArchive.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
@@ -18,11 +18,11 @@ import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.util.io.ZipUtil;
+import com.jetbrains.edu.coursecreator.CCDocumentListener;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.*;
+import com.jetbrains.edu.coursecreator.ui.CreateCourseArchiveDialog;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCDocumentListener;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.*;
-import org.jetbrains.plugins.coursecreator.ui.CreateCourseArchiveDialog;
import java.io.*;
import java.util.Collections;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateLesson.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateLesson.java
similarity index 93%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateLesson.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateLesson.java
index 58b950b5a637..a92bdd7a87fb 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateLesson.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateLesson.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.ide.IdeView;
import com.intellij.ide.util.DirectoryChooserUtil;
@@ -13,11 +13,11 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.psi.PsiDirectory;
import com.intellij.util.PlatformIcons;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
public class CCCreateLesson extends DumbAwareAction {
public CCCreateLesson() {
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateTask.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateTask.java
similarity index 94%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateTask.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateTask.java
index 216727cb266d..1a83436de9dd 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateTask.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateTask.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.ide.IdeView;
import com.intellij.ide.fileTemplates.FileTemplate;
@@ -20,12 +20,12 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.util.PlatformIcons;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.CCUtils;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Task;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.CCUtils;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
-import org.jetbrains.plugins.coursecreator.format.Task;
public class CCCreateTask extends DumbAwareAction {
public CCCreateTask() {
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateTaskFile.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateTaskFile.java
similarity index 90%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateTaskFile.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateTaskFile.java
index 69b67190346a..6296ee839af4 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCCreateTaskFile.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateTaskFile.java
@@ -1,5 +1,6 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
+import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeView;
import com.intellij.ide.fileTemplates.FileTemplate;
import com.intellij.ide.fileTemplates.FileTemplateManager;
@@ -16,17 +17,16 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
-import icons.PythonPsiApiIcons;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Task;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
-import org.jetbrains.plugins.coursecreator.format.Task;
public class CCCreateTaskFile extends DumbAwareAction {
public CCCreateTaskFile() {
- super("Task File", "Create new Task File", PythonPsiApiIcons.PythonFile);
+ super("Task File", "Create new Task File", AllIcons.FileTypes.Text);
}
@Override
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCDeleteTaskWindow.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteTaskWindow.java
similarity index 83%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCDeleteTaskWindow.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteTaskWindow.java
index f7245a05fe9f..a1ebd24f4c2e 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCDeleteTaskWindow.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteTaskWindow.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
@@ -6,11 +6,11 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.TaskFile;
+import com.jetbrains.edu.coursecreator.format.TaskWindow;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.TaskFile;
-import org.jetbrains.plugins.coursecreator.format.TaskWindow;
import java.util.List;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRename.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRename.java
similarity index 95%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRename.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRename.java
index dbaee7590277..30265ae05b6e 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRename.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRename.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.ide.IdeView;
import com.intellij.ide.projectView.ProjectView;
@@ -26,9 +26,9 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.Course;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.Course;
import javax.swing.*;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRenameLesson.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRenameLesson.java
similarity index 88%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRenameLesson.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRenameLesson.java
index 3f580454ed6e..eaea9bf7e0ad 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRenameLesson.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRenameLesson.java
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.psi.PsiDirectory;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
public class CCRenameLesson extends CCRename {
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRenameTask.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRenameTask.java
similarity index 87%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRenameTask.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRenameTask.java
index 342621bf0d47..4690d0d1993f 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRenameTask.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRenameTask.java
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.psi.PsiDirectory;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
-import org.jetbrains.plugins.coursecreator.format.Task;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Task;
public class CCRenameTask extends CCRename {
public CCRenameTask() {
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRunTestsAction.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRunTestsAction.java
similarity index 84%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRunTestsAction.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRunTestsAction.java
index 777afc4e1a85..2d8d3a6980a3 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCRunTestsAction.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCRunTestsAction.java
@@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
-import com.intellij.execution.*;
+import com.intellij.execution.Location;
import com.intellij.execution.actions.ConfigurationContext;
-import com.intellij.execution.configurations.ConfigurationFactory;
-import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.icons.AllIcons;
-import com.intellij.ide.projectView.ProjectView;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
@@ -32,25 +29,21 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
-import com.intellij.util.PathUtil;
import com.intellij.util.containers.HashMap;
-import com.jetbrains.python.run.PythonConfigurationType;
-import com.jetbrains.python.run.PythonRunConfiguration;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;
-public class CCRunTestsAction extends AnAction {
+public abstract class CCRunTestsAction extends AnAction {
private static final Logger LOG = Logger.getInstance(CCRunTestsAction.class.getName());
public CCRunTestsAction() {
@@ -114,7 +107,7 @@ public class CCRunTestsAction extends AnAction {
run(context);
}
- public static void run(final @NotNull ConfigurationContext context) {
+ public void run(final @NotNull ConfigurationContext context) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
@@ -199,34 +192,10 @@ public class CCRunTestsAction extends AnAction {
}
}
- private static void executeTests(@NotNull final Project project,
+ protected abstract void executeTests(@NotNull final Project project,
@NotNull final VirtualFile virtualFile,
@NotNull final VirtualFile taskDir,
- @NotNull final VirtualFile testFile) {
- final ConfigurationFactory factory = PythonConfigurationType.getInstance().getConfigurationFactories()[0];
- final RunnerAndConfigurationSettings settings =
- RunManager.getInstance(project).createRunConfiguration("test", factory);
-
- final PythonRunConfiguration configuration = (PythonRunConfiguration)settings.getConfiguration();
- configuration.setScriptName(testFile.getPath());
- VirtualFile userFile = taskDir.findChild(virtualFile.getNameWithoutExtension() + ".py");
- if (userFile == null) {
- return;
- }
- VirtualFile ideaDir = project.getBaseDir().findChild(".idea");
- if (ideaDir == null) {
- return;
- }
- VirtualFileManager.getInstance().refreshWithoutFileWatcher(true);
- ProjectView.getInstance(project).refresh();
- VirtualFile courseDir = ideaDir.findChild("course");
- if (courseDir == null) {
- return;
- }
- configuration.setScriptParameters(PathUtil.toSystemDependentName(courseDir.getPath()) + " " + PathUtil.toSystemDependentName(userFile.getPath()));
- Executor executor = DefaultRunExecutor.getRunExecutorInstance();
- ProgramRunnerUtil.executeConfiguration(project, settings, executor);
- }
+ @NotNull final VirtualFile testFile);
@Nullable
private static Task getTask(@NotNull final Course course, @NotNull final VirtualFile taskDir) {
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCShowPreview.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java
similarity index 94%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCShowPreview.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java
index 97a1b0300688..4578ba87388d 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCShowPreview.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowPreview.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -34,16 +34,15 @@ import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
-import com.intellij.util.containers.hash.HashMap;
-import com.jetbrains.python.PythonFileType;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.*;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.*;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
+import java.util.HashMap;
import java.util.Map;
public class CCShowPreview extends DumbAwareAction {
@@ -118,7 +117,7 @@ public class CCShowPreview extends DumbAwareAction {
if (document == null) {
return;
}
- final EditorEx createdEditor = (EditorEx)factory.createEditor(document, project, PythonFileType.INSTANCE, true);
+ final EditorEx createdEditor = (EditorEx)factory.createEditor(document, project, userFile, true);
Disposer.register(project, new Disposable() {
public void dispose() {
factory.releaseEditor(createdEditor);
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCShowTaskWindowDetails.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowTaskWindowDetails.java
similarity index 85%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCShowTaskWindowDetails.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowTaskWindowDetails.java
index e8ae02bf44fa..fc235c2e8c69 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCShowTaskWindowDetails.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowTaskWindowDetails.java
@@ -1,12 +1,12 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.*;
+import com.jetbrains.edu.coursecreator.ui.CreateTaskWindowDialog;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.*;
-import org.jetbrains.plugins.coursecreator.ui.CreateTaskWindowDialog;
public class CCShowTaskWindowDetails extends CCTaskWindowAction {
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCTaskWindowAction.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCTaskWindowAction.java
similarity index 93%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCTaskWindowAction.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCTaskWindowAction.java
index 1917c308c1e7..1d7a8e31adca 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/actions/CCTaskWindowAction.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCTaskWindowAction.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.actions;
+package com.jetbrains.edu.coursecreator.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
@@ -8,11 +8,11 @@ import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.TaskFile;
+import com.jetbrains.edu.coursecreator.format.TaskWindow;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.TaskFile;
-import org.jetbrains.plugins.coursecreator.format.TaskWindow;
import javax.swing.*;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Course.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Course.java
similarity index 96%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Course.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Course.java
index e9af3472f260..7d725e7b19c9 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Course.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Course.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.format;
+package com.jetbrains.edu.coursecreator.format;
import com.google.gson.annotations.Expose;
import com.intellij.psi.PsiDirectory;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Lesson.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Lesson.java
similarity index 96%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Lesson.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Lesson.java
index bd91e8ec30af..360c37244a1a 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Lesson.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Lesson.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.format;
+package com.jetbrains.edu.coursecreator.format;
import com.google.gson.annotations.Expose;
import com.intellij.psi.PsiDirectory;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Task.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Task.java
similarity index 91%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Task.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Task.java
index 886add86ceb4..453fa007b28b 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/Task.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/Task.java
@@ -1,8 +1,8 @@
-package org.jetbrains.plugins.coursecreator.format;
+package com.jetbrains.edu.coursecreator.format;
import com.google.gson.annotations.Expose;
+import com.jetbrains.edu.coursecreator.CCProjectService;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
import java.util.HashMap;
import java.util.Map;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/TaskFile.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/TaskFile.java
similarity index 98%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/TaskFile.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/TaskFile.java
index 9fb10eaa179a..df5e5d0bc521 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/TaskFile.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/TaskFile.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.format;
+package com.jetbrains.edu.coursecreator.format;
import com.google.gson.annotations.Expose;
import com.intellij.openapi.editor.Document;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/TaskWindow.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/TaskWindow.java
similarity index 97%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/TaskWindow.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/TaskWindow.java
index 385aaeddf26e..edcca8a7e7e7 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/format/TaskWindow.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/format/TaskWindow.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.format;
+package com.jetbrains.edu.coursecreator.format;
import com.google.gson.annotations.Expose;
import com.intellij.openapi.editor.Document;
@@ -14,8 +14,8 @@ import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.JBColor;
+import com.jetbrains.edu.coursecreator.CCProjectService;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
import java.io.File;
import java.util.List;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/projectView/CCDirectoryNode.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCDirectoryNode.java
similarity index 88%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/projectView/CCDirectoryNode.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCDirectoryNode.java
index 0969c54563c2..eb48a7af42a8 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/projectView/CCDirectoryNode.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCDirectoryNode.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.projectView;
+package com.jetbrains.edu.coursecreator.projectView;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.ide.projectView.ViewSettings;
@@ -6,11 +6,11 @@ import com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDirectory;
import com.intellij.ui.SimpleTextAttributes;
+import com.jetbrains.edu.coursecreator.CCProjectService;
+import com.jetbrains.edu.coursecreator.format.Course;
+import com.jetbrains.edu.coursecreator.format.Lesson;
+import com.jetbrains.edu.coursecreator.format.Task;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
-import org.jetbrains.plugins.coursecreator.format.Course;
-import org.jetbrains.plugins.coursecreator.format.Lesson;
-import org.jetbrains.plugins.coursecreator.format.Task;
public class CCDirectoryNode extends PsiDirectoryNode {
private final PsiDirectory myValue;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/projectView/CCTreeStructureProvider.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCTreeStructureProvider.java
similarity index 95%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/projectView/CCTreeStructureProvider.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCTreeStructureProvider.java
index 89d09f73c28c..e3a0ae7a3127 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/projectView/CCTreeStructureProvider.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/projectView/CCTreeStructureProvider.java
@@ -1,4 +1,4 @@
-package org.jetbrains.plugins.coursecreator.projectView;
+package com.jetbrains.edu.coursecreator.projectView;
import com.intellij.ide.projectView.TreeStructureProvider;
import com.intellij.ide.projectView.ViewSettings;
@@ -8,9 +8,9 @@ import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiDirectory;
+import com.jetbrains.edu.coursecreator.CCProjectService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.coursecreator.CCProjectService;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/ui/CCNewProjectPanel.form b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCNewProjectPanel.form
similarity index 97%
rename from python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/ui/CCNewProjectPanel.form
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCNewProjectPanel.form
index d0a931467943..67b2e6c3e5fe 100644
--- a/python/edu/course-creator/src/org/jetbrains/plugins/coursecreator/ui/CCNewProjectPanel.form
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCNewProjectPanel.form
@@ -1,5 +1,5 @@
-