Skip to content

Commit

Permalink
Application: Replace "no projects" hint with onboarding messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Feb 29, 2024
1 parent 2db06d4 commit b140fc4
Show file tree
Hide file tree
Showing 15 changed files with 240 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.shade.platform.model.runtime.VoidProgressMonitor;
import com.shade.platform.ui.PlatformMenuConstants;
import com.shade.platform.ui.UIColor;
import com.shade.platform.ui.controls.HintManager;
import com.shade.platform.ui.editors.Editor;
import com.shade.platform.ui.editors.EditorChangeListener;
import com.shade.platform.ui.editors.EditorInput;
Expand Down Expand Up @@ -279,15 +278,6 @@ public void windowOpened(WindowEvent event) {
if (!BuildConfig.APP_VERSION.equals(preferences.get("version", BuildConfig.APP_VERSION))) {
HelpMenu.ChangelogItem.open();
}

if (ProjectManager.getInstance().getProjects().length == 0) {
HintManager.showHint(new HintManager.Hint(
"It looks like you don't have any projects.<br><br>Use <kbd>File</kbd> &rArr; <kbd>New</kbd> &rArr; <kbd>Project</kbd> to start.",
frame.getRootPane().getJMenuBar(),
SwingConstants.BOTTOM,
null
));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.shade.decima.ui.editor.impl;

import com.shade.decima.ui.menu.menus.EditMenu;
import com.shade.decima.ui.menu.menus.FileMenu;
import com.shade.decima.ui.menu.menus.ViewMenu;
import com.shade.platform.ui.editors.spi.EditorOnboarding;
import com.shade.platform.ui.editors.spi.EditorOnboardingProvider;
import com.shade.util.NotNull;

import java.util.List;

public class DefaultEditorOnboardingProvider implements EditorOnboardingProvider {
@NotNull
@Override
public Iterable<EditorOnboarding> getOnboardings() {
return List.of(
new EditorOnboarding.Action(FileMenu.NewProjectItem.ID, "Create new project"),
new EditorOnboarding.Action(EditMenu.FindFilesItem.ID, "Find files"),
new EditorOnboarding.Action(ViewMenu.RecentFilesItem.ID, "Show recent files"),
new EditorOnboarding.Text("Drop files here to open them")
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ public String getName(@NotNull MenuItemContext ctx) {
}
}

@MenuItemRegistration(parent = APP_MENU_EDIT_ID, name = "Find &Files\u2026", icon = "Action.searchIcon", keystroke = "ctrl shift F", group = APP_MENU_EDIT_GROUP_GENERAL, order = 1000)
@MenuItemRegistration(id = FindFilesItem.ID, parent = APP_MENU_EDIT_ID, name = "Find &Files\u2026", icon = "Action.searchIcon", keystroke = "ctrl shift F", group = APP_MENU_EDIT_GROUP_GENERAL, order = 1000)
public static class FindFilesItem extends MenuItem {
public static final String ID = APP_MENU_EDIT_ID + ".findFiles";

@Override
public void perform(@NotNull MenuItemContext ctx) {
final Project project = ctx.getData(CommonDataKeys.PROJECT_KEY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ public final class FileMenu extends Menu {
@MenuItemRegistration(id = APP_MENU_FILE_NEW_ID, parent = APP_MENU_FILE_ID, name = "&New", group = APP_MENU_FILE_GROUP_OPEN, order = 1000)
public static class NewItem extends MenuItem {}

@MenuItemRegistration(parent = APP_MENU_FILE_NEW_ID, name = "&Project\u2026", group = APP_MENU_FILE_GROUP_OPEN, order = 1000)
@MenuItemRegistration(id = NewProjectItem.ID, parent = APP_MENU_FILE_NEW_ID, name = "&Project\u2026", keystroke = "ctrl N", group = APP_MENU_FILE_GROUP_OPEN, order = 1000)
public static class NewProjectItem extends MenuItem {
public static final String ID = APP_MENU_FILE_NEW_ID + ".project";

@Override
public void perform(@NotNull MenuItemContext ctx) {
final ProjectEditDialog dialog = new ProjectEditDialog(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ public void perform(@NotNull MenuItemContext ctx) {
}
}

@MenuItemRegistration(parent = APP_MENU_VIEW_ID, name = "Rec&ent Editors", keystroke = "ctrl E", group = APP_MENU_VIEW_GROUP_GENERAL, order = 1000)
@MenuItemRegistration(id = RecentFilesItem.ID, parent = APP_MENU_VIEW_ID, name = "Rec&ent Editors", keystroke = "ctrl E", group = APP_MENU_VIEW_GROUP_GENERAL, order = 1000)
public static class RecentFilesItem extends MenuItem {
public static final String ID = APP_MENU_VIEW_ID + ".recentEditors";

@Override
public void perform(@NotNull MenuItemContext ctx) {
new RecentEditorsDialog(JOptionPane.getRootFrame());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.shade.decima.ui.editor.impl.DefaultEditorOnboardingProvider

This file was deleted.

Loading

0 comments on commit b140fc4

Please sign in to comment.