Skip to content

Commit 756d34c

Browse files
committed
refactoring
1 parent 3dcde66 commit 756d34c

5 files changed

Lines changed: 72 additions & 19 deletions

File tree

src/main/java/com/ss/editor/model/undo/UndoableEditor.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.ss.editor.model.undo;
22

3+
import com.ss.editor.annotation.FXThread;
4+
35
/**
46
* The interface to implement an undoable editor.
57
*
@@ -10,10 +12,12 @@ public interface UndoableEditor {
1012
/**
1113
* Increment changes count.
1214
*/
15+
@FXThread
1316
void incrementChange();
1417

1518
/**
1619
* Decrement changes count.
1720
*/
21+
@FXThread
1822
void decrementChange();
1923
}

src/main/java/com/ss/editor/model/undo/editor/MaterialChangeConsumer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.jme3.material.Material;
44
import com.ss.editor.annotation.FXThread;
55

6+
import com.ss.editor.annotation.FromAnyThread;
67
import org.jetbrains.annotations.NotNull;
78

89
/**
@@ -18,7 +19,7 @@ public interface MaterialChangeConsumer {
1819
* @return the current material.
1920
*/
2021
@NotNull
21-
@FXThread
22+
@FromAnyThread
2223
Material getCurrentMaterial();
2324

2425
/**

src/main/java/com/ss/editor/state/editor/impl/material/MaterialEditor3DState.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public MaterialEditor3DState(@NotNull final MaterialFileEditor fileEditor) {
134134
this.testSphere = new Geometry("Sphere", new Sphere(30, 30, 2));
135135
this.testQuad = new Geometry("Quad", new Quad(4, 4));
136136
this.testQuad.setLocalTranslation(QUAD_OFFSET);
137-
this.lightEnabled = true;
137+
this.lightEnabled = MaterialFileEditor.DEFAULT_LIGHT_ENABLED;
138138

139139
TangentGenerator.useMikktspaceGenerator(testBox);
140140
TangentGenerator.useMikktspaceGenerator(testSphere);

src/main/java/com/ss/editor/ui/component/editor/impl/AbstractFileEditor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ private void processMousePressed(@NotNull final MouseEvent mouseEvent) {
238238
*
239239
* @param event the event
240240
*/
241+
@FXThread
241242
protected void processKeyReleased(@NotNull final KeyEvent event) {
242243

243244
final KeyCode code = event.getCode();
@@ -290,6 +291,7 @@ protected void processKeyPressed(@NotNull final KeyEvent event) {
290291
*
291292
* @param container the container
292293
*/
294+
@FXThread
293295
protected void createToolbar(@NotNull final HBox container) {
294296
}
295297

@@ -365,6 +367,7 @@ protected void postSave() {
365367
*
366368
* @return true if this editor needs a toolbar.
367369
*/
370+
@FXThread
368371
protected boolean needToolbar() {
369372
return false;
370373
}
@@ -375,13 +378,15 @@ protected boolean needToolbar() {
375378
* @return the new root.
376379
*/
377380
@NotNull
381+
@FXThread
378382
protected abstract R createRoot();
379383

380384
/**
381385
* Create content.
382386
*
383387
* @param root the root
384388
*/
389+
@FXThread
385390
protected abstract void createContent(@NotNull final R root);
386391

387392
@NotNull
@@ -405,8 +410,8 @@ public String getFileName() {
405410
return fileName.toString();
406411
}
407412

408-
@FXThread
409413
@Override
414+
@FXThread
410415
public void openFile(@NotNull final Path file) {
411416
FX_EVENT_MANAGER.addEventHandler(FileChangedEvent.EVENT_TYPE, getFileChangedHandler());
412417

@@ -535,6 +540,7 @@ public void notifyClosed() {
535540
*
536541
* @param event the event
537542
*/
543+
@FXThread
538544
protected void processChangedFile(@NotNull final FileChangedEvent event) {
539545

540546
final Path file = event.getFile();
@@ -555,6 +561,7 @@ protected void processChangedFile(@NotNull final FileChangedEvent event) {
555561
/**
556562
* Handle external changes of the edited file.
557563
*/
564+
@FXThread
558565
protected void handleExternalChanges() {
559566

560567
}

0 commit comments

Comments
 (0)