Skip to content

Commit e00ad41

Browse files
committed
мелкие правки
1 parent 474a5e2 commit e00ad41

File tree

5 files changed

+39
-24
lines changed

5 files changed

+39
-24
lines changed

resources/messages/messages.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,6 @@ CreateSkyDialogTopLabel=Top texture
139139
CreateSkyDialogBottomLabel=Bottom texture
140140

141141
EmptyModelCreatorDescription=New model
142-
EmptyModelCreatorTitle=Create new model
142+
EmptyModelCreatorTitle=Create new model
143+
144+
GLSLFileEditorName=GLSL редактор

resources/messages/messages_ru.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,6 @@ CreateSkyDialogTopLabel=Верхняя текстура
139139
CreateSkyDialogBottomLabel=Нижняя текстура
140140

141141
EmptyModelCreatorDescription=Новая модель
142-
EmptyModelCreatorTitle=Создание новой модели
142+
EmptyModelCreatorTitle=Создание новой модели
143+
144+
GLSLFileEditorName=GLSL editor

src/com/ss/editor/Messages.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ public class Messages {
153153
public static final String EMPTY_MODEL_CREATOR_DESCRIPTION;
154154
public static final String EMPTY_MODEL_CREATOR_TITLE;
155155

156+
public static final String GLSL_FILE_EDITOR_NAME;
157+
156158
static {
157159

158160
final ResourceBundle bundle = ResourceBundle.getBundle(BUNDLE_NAME, ResourceControl.getInstance());
@@ -299,5 +301,7 @@ public class Messages {
299301

300302
EMPTY_MODEL_CREATOR_DESCRIPTION = bundle.getString("EmptyModelCreatorDescription");
301303
EMPTY_MODEL_CREATOR_TITLE = bundle.getString("EmptyModelCreatorTitle");
304+
305+
GLSL_FILE_EDITOR_NAME = bundle.getString("GLSLFileEditorName");
302306
}
303307
}

src/com/ss/editor/manager/FileIconManager.java

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.ss.editor.manager;
22

3+
import com.ss.editor.FileExtensions;
34
import com.ss.editor.util.EditorUtil;
45

56
import java.io.IOException;
@@ -34,17 +35,16 @@ public class FileIconManager {
3435
private static final ObjectDictionary<String, String> EXTENSION_TO_CONTENT_TYPE = DictionaryFactory.newObjectDictionary();
3536

3637
static {
37-
EXTENSION_TO_CONTENT_TYPE.put("png", "image-png");
38-
EXTENSION_TO_CONTENT_TYPE.put("jpg", "image-jpeg");
39-
EXTENSION_TO_CONTENT_TYPE.put("jpeg", "image-jpeg");
40-
EXTENSION_TO_CONTENT_TYPE.put("tiff", "image-tiff");
41-
EXTENSION_TO_CONTENT_TYPE.put("gif", "image-gif");
42-
EXTENSION_TO_CONTENT_TYPE.put("bmp", "image-bmp");
43-
EXTENSION_TO_CONTENT_TYPE.put("png", "image-png");
44-
EXTENSION_TO_CONTENT_TYPE.put("tga", "image-jpeg");
38+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_JPEG, "image-jpeg");
39+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_JPG, "image-jpeg");
40+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_TIFF, "image-tiff");
41+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_GIF, "image-gif");
42+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_BMP, "image-bmp");
43+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_PNG, "image-png");
44+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_TGA, "image-jpeg");
4545
EXTENSION_TO_CONTENT_TYPE.put("psd", "image-psd");
46-
EXTENSION_TO_CONTENT_TYPE.put("dds", "image-jpeg");
47-
EXTENSION_TO_CONTENT_TYPE.put("hdr", "image-jpeg");
46+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_DDS, "image-jpeg");
47+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.IMAGE_HDR, "image-jpeg");
4848

4949
EXTENSION_TO_CONTENT_TYPE.put("ogg", "sound");
5050
EXTENSION_TO_CONTENT_TYPE.put("wav", "sound");
@@ -60,14 +60,20 @@ public class FileIconManager {
6060

6161
EXTENSION_TO_CONTENT_TYPE.put("java", "application-x-java");
6262

63-
EXTENSION_TO_CONTENT_TYPE.put("j3o", "jme3");
64-
EXTENSION_TO_CONTENT_TYPE.put("j3m", "jme3");
65-
EXTENSION_TO_CONTENT_TYPE.put("j3md", "jme3");
63+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.JME_OBJECT, "jme3");
64+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.JME_MATERIAL, "gnome-mime-text");
65+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.JME_MATERIAL_DEFINITION, "gnome-mime-text");
6666

6767
EXTENSION_TO_CONTENT_TYPE.put("obj", "application/x-tgif");
6868
EXTENSION_TO_CONTENT_TYPE.put("blend", "application-x-blender");
6969
EXTENSION_TO_CONTENT_TYPE.put("j3odata", "gnome-mime-text");
7070
EXTENSION_TO_CONTENT_TYPE.put("pfv", "gnome-mime-text");
71+
EXTENSION_TO_CONTENT_TYPE.put("xml", "application-xml");
72+
EXTENSION_TO_CONTENT_TYPE.put("exe", "application-x-ms-dos-executable");
73+
EXTENSION_TO_CONTENT_TYPE.put("sh", "application-x-shellscript");
74+
75+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.GLSL_FRAGMENT, "gnome-mime-text-x-csharp");
76+
EXTENSION_TO_CONTENT_TYPE.put(FileExtensions.GLSL_VERTEX, "gnome-mime-text-x-csharp");
7177
}
7278

7379
private static FileIconManager instance;
@@ -100,19 +106,19 @@ public FileIconManager() {
100106
*/
101107
public Image getIcon(final Path path, int size) {
102108

103-
String contentType = null;
109+
final String extension = FileUtils.getExtension(path);
110+
String contentType = EXTENSION_TO_CONTENT_TYPE.get(extension);
104111

105-
try {
106-
contentType = Files.probeContentType(path);
107-
} catch (IOException e) {
108-
LOGGER.warning(e);
112+
if(contentType == null) {
113+
try {
114+
contentType = Files.probeContentType(path);
115+
} catch (IOException e) {
116+
LOGGER.warning(e);
117+
}
109118
}
110119

111120
if (Files.isDirectory(path)) {
112121
contentType = "folder";
113-
} else if (contentType == null) {
114-
final String extension = FileUtils.getExtension(path);
115-
contentType = EXTENSION_TO_CONTENT_TYPE.get(extension);
116122
}
117123

118124
if (contentType != null) {

src/com/ss/editor/ui/component/editor/impl/GLSLFileEditor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.ss.editor.ui.component.editor.impl;
22

33
import com.ss.editor.FileExtensions;
4+
import com.ss.editor.Messages;
45
import com.ss.editor.ui.component.editor.EditorDescription;
56
import com.ss.editor.ui.css.CSSClasses;
67
import com.ss.editor.ui.css.CSSIds;
@@ -37,7 +38,7 @@ public class GLSLFileEditor extends AbstractFileEditor<VBox> {
3738

3839
static {
3940
DESCRIPTION.setConstructor(GLSLFileEditor::new);
40-
DESCRIPTION.setEditorName("GLSL Editor");
41+
DESCRIPTION.setEditorName(Messages.GLSL_FILE_EDITOR_NAME);
4142
DESCRIPTION.addExtension(FileExtensions.GLSL_FRAGMENT);
4243
DESCRIPTION.addExtension(FileExtensions.GLSL_VERTEX);
4344
}

0 commit comments

Comments
 (0)