diff --git a/python/educational/course-creator/resources/META-INF/plugin.xml b/python/educational/course-creator/resources/META-INF/plugin.xml
index 200574534a05..8e7935ce8336 100644
--- a/python/educational/course-creator/resources/META-INF/plugin.xml
+++ b/python/educational/course-creator/resources/META-INF/plugin.xml
@@ -58,10 +58,10 @@
-
+
-
+
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCDocumentListener.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCDocumentListener.java
index c03a099026a4..f05199320fc1 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCDocumentListener.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCDocumentListener.java
@@ -17,7 +17,7 @@ import java.util.List;
*/
public abstract class CCDocumentListener extends DocumentAdapter {
private final TaskFile myTaskFile;
- private final List myTaskWindows = new ArrayList();
+ private final List myAnswerPlaceholders = new ArrayList();
public CCDocumentListener(TaskFile taskFile) {
@@ -30,12 +30,12 @@ public abstract class CCDocumentListener extends DocumentAdapter {
@Override
public void beforeDocumentChange(DocumentEvent e) {
Document document = e.getDocument();
- myTaskWindows.clear();
+ myAnswerPlaceholders.clear();
for (AnswerPlaceholder answerPlaceholder : myTaskFile.getAnswerPlaceholders()) {
int twStart = answerPlaceholder.getRealStartOffset(document);
int length = useLength() ? answerPlaceholder.getLength() : answerPlaceholder.getPossibleAnswerLength();
int twEnd = twStart + length;
- myTaskWindows.add(new TaskWindowWrapper(answerPlaceholder, twStart, twEnd));
+ myAnswerPlaceholders.add(new AnswerPlaceholedrWrapper(answerPlaceholder, twStart, twEnd));
}
}
@@ -46,16 +46,16 @@ public abstract class CCDocumentListener extends DocumentAdapter {
Document document = e.getDocument();
int offset = e.getOffset();
int change = event.getNewLength() - event.getOldLength();
- for (TaskWindowWrapper taskWindowWrapper : myTaskWindows) {
- int twStart = taskWindowWrapper.getTwStart();
+ for (AnswerPlaceholedrWrapper answerPlaceholedrWrapper : myAnswerPlaceholders) {
+ int twStart = answerPlaceholedrWrapper.getTwStart();
if (twStart > offset) {
twStart += change;
}
- int twEnd = taskWindowWrapper.getTwEnd();
+ int twEnd = answerPlaceholedrWrapper.getTwEnd();
if (twEnd >= offset) {
twEnd += change;
}
- AnswerPlaceholder answerPlaceholder = taskWindowWrapper.getAnswerPlaceholder();
+ AnswerPlaceholder answerPlaceholder = answerPlaceholedrWrapper.getAnswerPlaceholder();
int line = document.getLineNumber(twStart);
int start = twStart - document.getLineStartOffset(line);
int length = twEnd - twStart;
@@ -64,7 +64,7 @@ public abstract class CCDocumentListener extends DocumentAdapter {
if (useLength()) {
answerPlaceholder.setLength(length);
} else {
- answerPlaceholder.setPossibleAnswer(document.getText(TextRange.create(start, start + length )));
+ answerPlaceholder.setPossibleAnswer(document.getText(TextRange.create(start, start + length)));
}
}
}
@@ -72,12 +72,12 @@ public abstract class CCDocumentListener extends DocumentAdapter {
protected abstract boolean useLength();
- private static class TaskWindowWrapper {
+ private static class AnswerPlaceholedrWrapper {
public AnswerPlaceholder myAnswerPlaceholder;
public int myTwStart;
public int myTwEnd;
- public TaskWindowWrapper(AnswerPlaceholder answerPlaceholder, int twStart, int twEnd) {
+ public AnswerPlaceholedrWrapper(AnswerPlaceholder answerPlaceholder, int twStart, int twEnd) {
myAnswerPlaceholder = answerPlaceholder;
myTwStart = twStart;
myTwEnd = twEnd;
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCEditorFactoryListener.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCEditorFactoryListener.java
index e32072273bc5..008eb177b7da 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCEditorFactoryListener.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCEditorFactoryListener.java
@@ -9,9 +9,9 @@ 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.EduAnswerPlaceholderDeleteHandler;
import com.jetbrains.edu.EduAnswerPlaceholderPainter;
import com.jetbrains.edu.EduNames;
-import com.jetbrains.edu.EduTaskWindowDeleteHandler;
import com.jetbrains.edu.courseFormat.Course;
import com.jetbrains.edu.courseFormat.TaskFile;
import org.jetbrains.annotations.NotNull;
@@ -47,8 +47,8 @@ public class CCEditorFactoryListener implements EditorFactoryListener {
CCProjectService.addDocumentListener(editor.getDocument(), listener);
editor.getDocument().addDocumentListener(listener);
EditorActionManager.getInstance()
- .setReadonlyFragmentModificationHandler(editor.getDocument(), new EduTaskWindowDeleteHandler(editor));
- service.drawTaskWindows(virtualFile, editor);
+ .setReadonlyFragmentModificationHandler(editor.getDocument(), new EduAnswerPlaceholderDeleteHandler(editor));
+ service.drawAnswerPlaceholders(virtualFile, editor);
editor.getColorsScheme().setColor(EditorColors.READONLY_FRAGMENT_BACKGROUND_COLOR, null);
EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, false);
}
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectService.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectService.java
index 4b64f6162144..32b617ca83ac 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectService.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/CCProjectService.java
@@ -133,7 +133,7 @@ public class CCProjectService implements PersistentStateComponent answerPlaceholders = taskFile.getAnswerPlaceholders();
for (AnswerPlaceholder existingAnswerPlaceholder : answerPlaceholders) {
int twStart = existingAnswerPlaceholder.getRealStartOffset(document);
@@ -75,7 +75,7 @@ public class CCAddAnswerPlaceholder extends DumbAwareAction {
if (taskFile == null) {
return;
}
- if (areTaskWindowsIntersect(taskFile, document, start, end)) {
+ if (arePlaceholdersIntersect(taskFile, document, start, end)) {
return;
}
final AnswerPlaceholder answerPlaceholder = new AnswerPlaceholder();
@@ -83,7 +83,7 @@ public class CCAddAnswerPlaceholder extends DumbAwareAction {
answerPlaceholder.setStart(realStart);
answerPlaceholder.setPossibleAnswer(model.getSelectedText());
- CreateTaskWindowDialog dlg = new CreateTaskWindowDialog(project, answerPlaceholder, lesson.getIndex(),
+ CCCreateAnswerPlaceholderDialog dlg = new CCCreateAnswerPlaceholderDialog(project, answerPlaceholder, lesson.getIndex(),
task.getIndex(), file.getVirtualFile().getNameWithoutExtension(),
taskFile.getAnswerPlaceholders().size() + 1);
dlg.show();
@@ -150,7 +150,7 @@ public class CCAddAnswerPlaceholder extends DumbAwareAction {
presentation.setEnabled(false);
return;
}
- if (areTaskWindowsIntersect(taskFile, editor.getDocument(), start, end)) {
+ if (arePlaceholdersIntersect(taskFile, editor.getDocument(), start, end)) {
presentation.setVisible(false);
presentation.setEnabled(false);
return;
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCTaskWindowAction.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAnswerPlaceholderAction.java
similarity index 91%
rename from python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCTaskWindowAction.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAnswerPlaceholderAction.java
index a01c56a2c1a8..cee7038371e5 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCTaskWindowAction.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCAnswerPlaceholderAction.java
@@ -16,9 +16,9 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-abstract public class CCTaskWindowAction extends DumbAwareAction {
+abstract public class CCAnswerPlaceholderAction extends DumbAwareAction {
- protected CCTaskWindowAction(@Nullable String text, @Nullable String description, @Nullable Icon icon) {
+ protected CCAnswerPlaceholderAction(@Nullable String text, @Nullable String description, @Nullable Icon icon) {
super(text, description, icon);
}
@@ -65,10 +65,10 @@ abstract public class CCTaskWindowAction extends DumbAwareAction {
if (state == null) {
return;
}
- performTaskWindowAction(state);
+ performAnswerPlaceholderAction(state);
}
- protected abstract void performTaskWindowAction(@NotNull final CCState state);
+ protected abstract void performAnswerPlaceholderAction(@NotNull final CCState state);
protected static class CCState {
private TaskFile myTaskFile;
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
index 0bb5d8fa0bab..acd5c96ee68c 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCCreateCourseArchive.java
@@ -154,7 +154,7 @@ public class CCCreateCourseArchive extends DumbAwareAction {
Collections.sort(taskFile.getAnswerPlaceholders(), new AnswerPlaceholderComparator());
for (int i = taskFile.getAnswerPlaceholders().size() - 1; i >= 0; i--) {
final AnswerPlaceholder answerPlaceholder = taskFile.getAnswerPlaceholders().get(i);
- replaceTaskWindow(project, document, answerPlaceholder);
+ replaceAnswerPlaceholder(project, document, answerPlaceholder);
}
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
@@ -170,9 +170,9 @@ public class CCCreateCourseArchive extends DumbAwareAction {
document.removeDocumentListener(listener);
}
- private static void replaceTaskWindow(@NotNull final Project project,
- @NotNull final Document document,
- @NotNull final AnswerPlaceholder answerPlaceholder) {
+ private static void replaceAnswerPlaceholder(@NotNull final Project project,
+ @NotNull final Document document,
+ @NotNull final AnswerPlaceholder answerPlaceholder) {
final String taskText = answerPlaceholder.getTaskText();
final int lineStartOffset = document.getLineStartOffset(answerPlaceholder.getLine());
final int offset = lineStartOffset + answerPlaceholder.getStart();
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteTaskWindow.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteAnswerPlaceholder.java
similarity index 82%
rename from python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteTaskWindow.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteAnswerPlaceholder.java
index e111a3feb973..21dc1385c1a0 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteTaskWindow.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCDeleteAnswerPlaceholder.java
@@ -13,14 +13,14 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
-public class CCDeleteTaskWindow extends CCTaskWindowAction {
+public class CCDeleteAnswerPlaceholder extends CCAnswerPlaceholderAction {
- public CCDeleteTaskWindow() {
+ public CCDeleteAnswerPlaceholder() {
super("Delete Answer Placeholder","Delete answer placeholder", null);
}
@Override
- protected void performTaskWindowAction(@NotNull CCState state) {
+ protected void performAnswerPlaceholderAction(@NotNull CCState state) {
Project project = state.getProject();
PsiFile psiFile = state.getFile();
final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
@@ -32,7 +32,7 @@ public class CCDeleteTaskWindow extends CCTaskWindowAction {
answerPlaceholders.remove(answerPlaceholder);
final Editor editor = state.getEditor();
editor.getMarkupModel().removeAllHighlighters();
- CCProjectService.getInstance(project).drawTaskWindows(psiFile.getVirtualFile(), editor);
+ CCProjectService.getInstance(project).drawAnswerPlaceholders(psiFile.getVirtualFile(), editor);
EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, false);
}
}
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowTaskWindowDetails.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowAnswerPlaceholderDetails.java
similarity index 77%
rename from python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowTaskWindowDetails.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowAnswerPlaceholderDetails.java
index b4c955091d05..d030811460ca 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowTaskWindowDetails.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCShowAnswerPlaceholderDetails.java
@@ -8,17 +8,17 @@ import com.jetbrains.edu.courseFormat.Lesson;
import com.jetbrains.edu.courseFormat.Task;
import com.jetbrains.edu.courseFormat.TaskFile;
import com.jetbrains.edu.coursecreator.CCProjectService;
-import com.jetbrains.edu.coursecreator.ui.CreateTaskWindowDialog;
+import com.jetbrains.edu.coursecreator.ui.CCCreateAnswerPlaceholderDialog;
import org.jetbrains.annotations.NotNull;
-public class CCShowTaskWindowDetails extends CCTaskWindowAction {
+public class CCShowAnswerPlaceholderDetails extends CCAnswerPlaceholderAction {
- public CCShowTaskWindowDetails() {
+ public CCShowAnswerPlaceholderDetails() {
super("Edit Answer Placeholder", "Edit answer placeholder", null);
}
@Override
- protected void performTaskWindowAction(@NotNull CCState state) {
+ protected void performAnswerPlaceholderAction(@NotNull CCState state) {
final Project project = state.getProject();
final CCProjectService service = CCProjectService.getInstance(project);
PsiFile file = state.getFile();
@@ -29,7 +29,7 @@ public class CCShowTaskWindowDetails extends CCTaskWindowAction {
final Task task = service.getTask(taskDir.getVirtualFile().getPath());
final TaskFile taskFile = state.getTaskFile();
AnswerPlaceholder answerPlaceholder = state.getAnswerPlaceholder();
- CreateTaskWindowDialog dlg = new CreateTaskWindowDialog(project, answerPlaceholder, lesson.getIndex(), task.getIndex(),
+ CCCreateAnswerPlaceholderDialog dlg = new CCCreateAnswerPlaceholderDialog(project, answerPlaceholder, lesson.getIndex(), task.getIndex(),
file.getVirtualFile().getNameWithoutExtension(),
taskFile.getAnswerPlaceholders().size() + 1);
dlg.setTitle("Edit Answer Placeholder");
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskWindowDialog.java b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderDialog.java
similarity index 65%
rename from python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskWindowDialog.java
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderDialog.java
index 306c14a8b887..aef30163da65 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskWindowDialog.java
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderDialog.java
@@ -11,31 +11,33 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
-public class CreateTaskWindowDialog extends DialogWrapper {
+public class CCCreateAnswerPlaceholderDialog extends DialogWrapper {
private static final String ourTitle = "Add Answer Placeholder";
private final AnswerPlaceholder myAnswerPlaceholder;
- private final CreateTaskWindowPanel myPanel;
+ private final CCCreateAnswerPlaceholderPanel myPanel;
private final Project myProject;
public Project getProject() {
return myProject;
}
- public CreateTaskWindowDialog(@NotNull final Project project, @NotNull final AnswerPlaceholder answerPlaceholder, int lessonIndex,
- int taskIndex, String taskFileName, int taskWindowIndex) {
+ public CCCreateAnswerPlaceholderDialog(@NotNull final Project project,
+ @NotNull final AnswerPlaceholder answerPlaceholder,
+ int lessonIndex, int taskIndex, String taskFileName,
+ int answerPlaceholderIndex) {
super(project, true);
setTitle(ourTitle);
myAnswerPlaceholder = answerPlaceholder;
- myPanel = new CreateTaskWindowPanel(this);
- String generatedHintName = EduNames.LESSON + lessonIndex + EduNames.TASK + taskIndex + taskFileName + "_" + taskWindowIndex;
+ myPanel = new CCCreateAnswerPlaceholderPanel(this);
+ String generatedHintName = EduNames.LESSON + lessonIndex + EduNames.TASK + taskIndex + taskFileName + "_" + answerPlaceholderIndex;
myPanel.setGeneratedHintName(generatedHintName);
if (answerPlaceholder.getHint() != null) {
setHintText(answerPlaceholder);
}
myProject = project;
- String taskWindowTaskText = answerPlaceholder.getTaskText();
- myPanel.setTaskWindowText(taskWindowTaskText != null ? taskWindowTaskText : "");
+ String answerPlaceholderTaskText = answerPlaceholder.getTaskText();
+ myPanel.setAnswerPlaceholderText(answerPlaceholderTaskText != null ? answerPlaceholderTaskText : "");
String hintName = answerPlaceholder.getHint();
myPanel.setHintText(hintName != null ? hintName : "");
init();
@@ -52,9 +54,9 @@ public class CreateTaskWindowDialog extends DialogWrapper {
@Override
protected void doOKAction() {
- String taskWindowText = myPanel.getAnswerPlaceholderText();
- myAnswerPlaceholder.setTaskText(StringUtil.notNullize(taskWindowText));
- myAnswerPlaceholder.setLength(StringUtil.notNullize(taskWindowText).length());
+ String answerPlaceholderText = myPanel.getAnswerPlaceholderText();
+ myAnswerPlaceholder.setTaskText(StringUtil.notNullize(answerPlaceholderText));
+ myAnswerPlaceholder.setLength(StringUtil.notNullize(answerPlaceholderText).length());
myAnswerPlaceholder.setHint(myPanel.getHintText());
super.doOKAction();
}
diff --git a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskWindowPanel.form b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderPanel.form
similarity index 97%
rename from python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskWindowPanel.form
rename to python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderPanel.form
index 4de02982ef9a..41ee5454c672 100644
--- a/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CreateTaskWindowPanel.form
+++ b/python/educational/course-creator/src/com/jetbrains/edu/coursecreator/ui/CCCreateAnswerPlaceholderPanel.form
@@ -1,5 +1,5 @@
-