Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,11 @@ private MenuBar createMenu(final Stage stage) {
return menuBar;
}

private List<String> listOfLayouts = new LinkedList<>();
protected List<String> getListOfLayouts() {
return listOfLayouts;
}

/**
* Create the load past layouts menu
*/
Expand Down Expand Up @@ -642,6 +647,7 @@ void createLoadLayoutsMenu() {
}


listOfLayouts = new LinkedList<>();
// For every non default memento file create a menu item for the load layout menu.
if (!layoutFiles.keySet().isEmpty()) {
// Sort layout files alphabetically.
Expand All @@ -655,6 +661,8 @@ void createLoadLayoutsMenu() {
// Remove ".memento"
filename = filename.substring(0, filename.length() - 8);

listOfLayouts.add(filename);

// Build the list of memento files.
memento_files.add(filename);
final MenuItem menuItem = new MenuItem(filename);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.TextInputDialog;
import org.phoebus.framework.autocomplete.Proposal;
import org.phoebus.framework.autocomplete.ProposalProvider;
import org.phoebus.framework.autocomplete.ProposalService;
import org.phoebus.framework.jobs.JobManager;
import org.phoebus.framework.workbench.Locations;
import org.phoebus.ui.autocomplete.AutocompleteMenu;
import org.phoebus.ui.dialog.DialogHelper;
import org.phoebus.ui.docking.DockItem;
import org.phoebus.ui.docking.DockItemWithInput;
Expand Down Expand Up @@ -89,6 +93,29 @@ public static boolean saveLayout(List<Stage> stagesToSave, String titleText)
prompt.setHeaderText(Messages.SaveDlgHdr);
positionDialog(prompt, stagesToSave.get(0));

{
ProposalProvider proposalProvider = new ProposalProvider() {
@Override
public String getName() {
return "Existing Layouts";
}

@Override
public List<Proposal> lookup(String text) {
List<Proposal> listOfProposals = new LinkedList<>();
for (String layout : PhoebusApplication.INSTANCE.getListOfLayouts()) {
if (layout.startsWith(text)) {
listOfProposals.add(new Proposal(layout));
}
}
return listOfProposals;
}
};
ProposalService proposalService = new ProposalService(proposalProvider);
AutocompleteMenu autocompleteMenu = new AutocompleteMenu(proposalService);
autocompleteMenu.attachField(prompt.getEditor());
}

while (true)
{
final String filename = prompt.showAndWait().orElse(null);
Expand Down