singleton instances for internal file types

This commit is contained in:
Maxim.Mossienko
2014-12-05 13:05:30 +01:00
parent a92f6b27e4
commit f9359d031a
4 changed files with 15 additions and 3 deletions
@@ -26,9 +26,13 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class WorkspaceFileType implements InternalFileType {
public static final WorkspaceFileType INSTANCE = new WorkspaceFileType();
@NonNls public static final String DEFAULT_EXTENSION = "iws";
@NonNls public static final String DOT_DEFAULT_EXTENSION = "." + DEFAULT_EXTENSION;
private WorkspaceFileType() {}
@Override
@NotNull
public String getName() {
@@ -27,8 +27,8 @@ import org.jetbrains.annotations.NotNull;
*/
public class InternalFileTypeFactory extends FileTypeFactory {
public void createFileTypes(@NotNull final FileTypeConsumer consumer) {
consumer.consume(new WorkspaceFileType(), WorkspaceFileType.DEFAULT_EXTENSION);
consumer.consume(new ModuleFileType(), ModuleFileType.DEFAULT_EXTENSION);
consumer.consume(new ProjectFileType(), ProjectFileType.DEFAULT_EXTENSION);
consumer.consume(WorkspaceFileType.INSTANCE, WorkspaceFileType.DEFAULT_EXTENSION);
consumer.consume(ModuleFileType.INSTANCE, ModuleFileType.DEFAULT_EXTENSION);
consumer.consume(ProjectFileType.INSTANCE, ProjectFileType.DEFAULT_EXTENSION);
}
}
@@ -26,9 +26,13 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class ModuleFileType implements InternalFileType {
public static final ModuleFileType INSTANCE = new ModuleFileType();
@NonNls public static final String DEFAULT_EXTENSION = "iml";
@NonNls public static final String DOT_DEFAULT_EXTENSION = ".iml";
private ModuleFileType() {}
@Override
@NotNull
public String getName() {
@@ -26,9 +26,13 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
public class ProjectFileType implements InternalFileType {
public static final ProjectFileType INSTANCE = new ProjectFileType();
@NonNls public static final String DEFAULT_EXTENSION = "ipr";
@NonNls public static final String DOT_DEFAULT_EXTENSION = ".ipr";
private ProjectFileType() {}
@Override
@NotNull
public String getName() {