mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
non-VFS based FileTemplatesManager
This commit is contained in:
@@ -447,7 +447,7 @@ public class CompileDriver {
|
||||
if (message != null) {
|
||||
compileContext.addMessage(message);
|
||||
}
|
||||
TranslatingCompilerFilesMonitor.getInstance().ensureInitializationCompleted(myProject);
|
||||
TranslatingCompilerFilesMonitor.getInstance().ensureInitializationCompleted(myProject, compileContext.getProgressIndicator());
|
||||
doCompile(compileContext, isRebuild, forceCompile, callback, checkCachesVersion);
|
||||
}
|
||||
finally {
|
||||
|
||||
+3
-3
@@ -965,16 +965,16 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
}
|
||||
}
|
||||
|
||||
public void ensureInitializationCompleted(Project project) {
|
||||
public void ensureInitializationCompleted(Project project, ProgressIndicator indicator) {
|
||||
final int id = getProjectId(project);
|
||||
synchronized (myInitializationLock) {
|
||||
while (myInitInProgress.contains(id)) {
|
||||
if (!project.isOpen() || project.isDisposed()) {
|
||||
if (!project.isOpen() || project.isDisposed() || (indicator != null && indicator.isCanceled())) {
|
||||
// makes no sense to continue waiting
|
||||
break;
|
||||
}
|
||||
try {
|
||||
myInitializationLock.wait();
|
||||
myInitializationLock.wait(500);
|
||||
}
|
||||
catch (InterruptedException ignored) {
|
||||
break;
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ public class JavaCreateFromTemplateHandler implements CreateFromTemplateHandler
|
||||
}
|
||||
|
||||
static void hackAwayEmptyPackage(PsiJavaFile file, FileTemplate template, Properties props) throws IncorrectOperationException {
|
||||
if (!template.isJavaClassTemplate()) return;
|
||||
if (!template.isTemplateOfType(StdFileTypes.JAVA)) return;
|
||||
|
||||
String packageName = props.getProperty(FileTemplate.ATTRIBUTE_PACKAGE_NAME);
|
||||
if(packageName == null || packageName.length() == 0 || packageName.equals(FileTemplate.ATTRIBUTE_PACKAGE_NAME)){
|
||||
@@ -104,7 +104,7 @@ public class JavaCreateFromTemplateHandler implements CreateFromTemplateHandler
|
||||
public PsiElement createFromTemplate(final Project project, final PsiDirectory directory, final String fileName, FileTemplate template,
|
||||
String templateText, Properties props) throws IncorrectOperationException {
|
||||
String extension = template.getExtension();
|
||||
PsiElement result = createClassOrInterface(project, directory, templateText, template.isAdjust(), extension);
|
||||
PsiElement result = createClassOrInterface(project, directory, templateText, template.isReformatCode(), extension);
|
||||
hackAwayEmptyPackage((PsiJavaFile)result.getContainingFile(), template, props);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class FileTemplatesTest extends IdeaTestCase {
|
||||
}
|
||||
finally {
|
||||
FileTemplateManager.getInstance().saveAll();
|
||||
FileTemplateManager.getInstance().removeTemplate(template, false);
|
||||
FileTemplateManager.getInstance().removeTemplate(template);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user