X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.model.editor%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fmodel%2Feditor%2Fui%2FEditorGUI.java;h=17e12ebb07ae4179ea79115a87da305c7bfa337c;hb=93b398d6271a538a2a4c9f4de07a3b4a8a2a7fd4;hp=28e285546129b937ade34a86711fd2be72a1e245;hpb=c5c0d07286a29994a11ba8b01eaffb21964b6c1b;p=Mograsim.git diff --git a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/ui/EditorGUI.java b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/ui/EditorGUI.java index 28e28554..17e12ebb 100644 --- a/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/ui/EditorGUI.java +++ b/net.mograsim.logic.model.editor/src/net/mograsim/logic/model/editor/ui/EditorGUI.java @@ -24,7 +24,7 @@ import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasOverlay; import net.haspamelodica.swt.helper.zoomablecanvas.helper.ZoomableCanvasUserInput; import net.mograsim.logic.model.editor.Editor; import net.mograsim.logic.model.editor.SaveLoadManager; -import net.mograsim.logic.model.serializing.IndirectGUIComponentCreator; +import net.mograsim.logic.model.serializing.IndirectModelComponentCreator; public class EditorGUI { @@ -52,7 +52,7 @@ public class EditorGUI innerCompData.horizontalAlignment = SWT.FILL; innerCompData.verticalAlignment = SWT.FILL; innerComp.setLayoutData(innerCompData); - + GridLayout innerLayout = new GridLayout(); innerComp.setLayout(innerLayout); innerLayout.numColumns = 2; @@ -65,7 +65,7 @@ public class EditorGUI logicCanvas = new EditorCanvas(innerComp, SWT.TRAIL, editor); logicCanvas.setLayoutData(d); - + d = new GridData(); d.grabExcessVerticalSpace = true; d.verticalAlignment = SWT.FILL; @@ -73,7 +73,7 @@ public class EditorGUI addList = new List(innerComp, SWT.V_SCROLL); addList.setLayoutData(d); refreshAddList(); - + setupBottomToolBar(innerComp); ZoomableCanvasUserInput userInput = new ZoomableCanvasUserInput(logicCanvas); @@ -94,25 +94,26 @@ public class EditorGUI ToolItem file = new ToolItem(toolBar, SWT.DROP_DOWN); - //TODO -// DropDownEntry newEntry = new DropDownEntry("New", e -> { -// }); - DropDownEntry loadEntry = new DropDownEntry("Load", e -> { + // TODO + DropDownEntry newEntry = new DropDownEntry("New", e -> Editor.openNewEditor()); + DropDownEntry loadEntry = new DropDownEntry("Load", e -> + { try { SaveLoadManager.openLoadDialog(); - } catch (IOException e1) + } + catch (IOException e1) { editor.dialogManager.openWarningDialog("Failed to load Component!", e1.getMessage()); } }); DropDownEntry saveEntry = new DropDownEntry("Save", e -> editor.save()); DropDownEntry saveAsEntry = new DropDownEntry("Save as...", e -> editor.saveAs()); - - DropDownEntry[] entries = new DropDownEntry[] { loadEntry, saveEntry, saveAsEntry}; - + + DropDownEntry[] entries = new DropDownEntry[] { newEntry, loadEntry, saveEntry, saveAsEntry }; + setupDrowpDownMenu(file, entries); - + file.setText("File"); return toolBar; } @@ -209,7 +210,7 @@ public class EditorGUI public void refreshAddList() { - addList.setItems(IndirectGUIComponentCreator.getStandardComponentIDs().toArray(String[]::new)); + addList.setItems(IndirectModelComponentCreator.getStandardComponentIDs().keySet().stream().sorted().toArray(String[]::new)); addList.select(0); } @@ -228,5 +229,4 @@ public class EditorGUI if (!display.readAndDispatch()) display.sleep(); } - -} +} \ No newline at end of file