diff --git a/app/credentials-management/src/main/java/org/phoebus/applications/credentialsmanagement/CredentialsManagementToolbarEntry.java b/app/credentials-management/src/main/java/org/phoebus/applications/credentialsmanagement/CredentialsManagementToolbarEntry.java index 557f83fc48..66acf10655 100644 --- a/app/credentials-management/src/main/java/org/phoebus/applications/credentialsmanagement/CredentialsManagementToolbarEntry.java +++ b/app/credentials-management/src/main/java/org/phoebus/applications/credentialsmanagement/CredentialsManagementToolbarEntry.java @@ -41,4 +41,13 @@ public Void call() throws Exception { ApplicationService.createInstance(CredentialsManagementApp.name); return null; } + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "Credentials Management"; + } } diff --git a/app/credentials-management/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry b/app/credentials-management/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry new file mode 100644 index 0000000000..3b0211cf6b --- /dev/null +++ b/app/credentials-management/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry @@ -0,0 +1 @@ +org.phoebus.applications.credentialsmanagement.CredentialsManagementToolbarEntry \ No newline at end of file diff --git a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/OpenDataBrowser.java b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/OpenDataBrowser.java index c3087d2797..d49627d172 100644 --- a/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/OpenDataBrowser.java +++ b/app/databrowser/src/main/java/org/csstudio/trends/databrowser3/OpenDataBrowser.java @@ -18,30 +18,34 @@ * @author Kay Kasemir */ @SuppressWarnings("nls") -public class OpenDataBrowser implements MenuEntry, ToolbarEntry -{ +public class OpenDataBrowser implements MenuEntry, ToolbarEntry { @Override - public String getName() - { + public String getName() { return Messages.DataBrowser; } @Override - public String getMenuPath() - { + public String getMenuPath() { return Messages.DataBrowserMenuPath; } @Override - public Image getIcon() - { + public Image getIcon() { return ImageCache.getImage(getClass(), "/icons/databrowser.png"); } @Override - public Void call() throws Exception - { + public Void call() throws Exception { ApplicationService.createInstance(DataBrowserApp.NAME); return null; } + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "Data Browser"; + } } diff --git a/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserToolbarEntry.java b/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserToolbarEntry.java index 75871877ce..824e18fdf9 100644 --- a/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserToolbarEntry.java +++ b/app/filebrowser/src/main/java/org/phoebus/applications/filebrowser/FileBrowserToolbarEntry.java @@ -25,4 +25,13 @@ public Void call() throws Exception { ApplicationService.createInstance(FileBrowserApp.Name); return null; } + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "File Browser"; + } } diff --git a/app/log-configuration/src/main/java/org/phoebus/applications/utility/LoggingConfigurationToolbarEntry.java b/app/log-configuration/src/main/java/org/phoebus/applications/utility/LoggingConfigurationToolbarEntry.java deleted file mode 100644 index 59919979e2..0000000000 --- a/app/log-configuration/src/main/java/org/phoebus/applications/utility/LoggingConfigurationToolbarEntry.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 Oak Ridge National Laboratory. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - *******************************************************************************/ -package org.phoebus.applications.utility; - -import org.phoebus.framework.workbench.ApplicationService; -import org.phoebus.ui.spi.ToolbarEntry; - -/** - * Toolbar entry that starts LoggingConfiguration - * - * @author Kunal Shroff - */ -// @ProviderFor(ToolbarEntry.class) -public class LoggingConfigurationToolbarEntry implements ToolbarEntry { - - @Override - public String getName() { - return LoggingConfigurationApplication.DISPLAY_NAME; - } - - @Override - public Void call() throws Exception { - ApplicationService.createInstance(LoggingConfigurationApplication.NAME); - return null; - } -} diff --git a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/LogEntryTableToolbarEntry.java b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/LogEntryTableToolbarEntry.java index 774f6fa636..96008e40b2 100644 --- a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/LogEntryTableToolbarEntry.java +++ b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/LogEntryTableToolbarEntry.java @@ -37,4 +37,13 @@ public Image getIcon() { return LogEntryTableApp.icon; } + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "Log Entry Table"; + } } diff --git a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/SendToLogBookToolbarEntry.java b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/SendToLogBookToolbarEntry.java index 3e5a15db23..9af98e54d1 100644 --- a/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/SendToLogBookToolbarEntry.java +++ b/app/logbook/olog/ui/src/main/java/org/phoebus/logbook/olog/ui/menu/SendToLogBookToolbarEntry.java @@ -39,4 +39,13 @@ public Image getIcon() { return SendToLogBookApp.icon; } + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "Send To Log Book"; + } } diff --git a/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/menu/SendToLogBookToolbarEntry.java b/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/menu/SendToLogBookToolbarEntry.java index e0c27ee9ff..12c79666e8 100644 --- a/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/menu/SendToLogBookToolbarEntry.java +++ b/app/logbook/ui/src/main/java/org/phoebus/logbook/ui/menu/SendToLogBookToolbarEntry.java @@ -40,4 +40,13 @@ public Image getIcon() { return SendToLogBookApp.icon; } + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "Send To Log Book"; + } } diff --git a/app/probe/src/main/java/org/phoebus/applications/probe/ProbeToolbarEntry.java b/app/probe/src/main/java/org/phoebus/applications/probe/ProbeToolbarEntry.java index e330ad1ab2..4db62b1092 100644 --- a/app/probe/src/main/java/org/phoebus/applications/probe/ProbeToolbarEntry.java +++ b/app/probe/src/main/java/org/phoebus/applications/probe/ProbeToolbarEntry.java @@ -20,4 +20,13 @@ public Void call() throws Exception { ApplicationService.createInstance(Probe.NAME); return null; } + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "Probe"; + } } diff --git a/app/probe/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry b/app/probe/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry new file mode 100644 index 0000000000..a793104f2f --- /dev/null +++ b/app/probe/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry @@ -0,0 +1 @@ +org.phoebus.applications.probe.ProbeToolbarEntry \ No newline at end of file diff --git a/app/pvtree/src/main/java/org/phoebus/applications/pvtree/PVTreeToolbarEntry.java b/app/pvtree/src/main/java/org/phoebus/applications/pvtree/PVTreeToolbarEntry.java index cbbada073a..754a0b52ba 100644 --- a/app/pvtree/src/main/java/org/phoebus/applications/pvtree/PVTreeToolbarEntry.java +++ b/app/pvtree/src/main/java/org/phoebus/applications/pvtree/PVTreeToolbarEntry.java @@ -27,4 +27,14 @@ public Void call() throws Exception ApplicationService.createInstance(PVTreeApplication.NAME); return null; } + + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "PV Tree"; + } } diff --git a/app/pvtree/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry b/app/pvtree/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry new file mode 100644 index 0000000000..a2a4479641 --- /dev/null +++ b/app/pvtree/src/main/resources/META-INF/services/org.phoebus.ui.spi.ToolbarEntry @@ -0,0 +1 @@ +org.phoebus.applications.pvtree.PVTreeToolbarEntry \ No newline at end of file diff --git a/app/scan/ui/src/main/java/org/csstudio/scan/ui/monitor/ScanMonitorMenuEntry.java b/app/scan/ui/src/main/java/org/csstudio/scan/ui/monitor/ScanMonitorMenuEntry.java index 20c1986e9e..d3b424d315 100644 --- a/app/scan/ui/src/main/java/org/csstudio/scan/ui/monitor/ScanMonitorMenuEntry.java +++ b/app/scan/ui/src/main/java/org/csstudio/scan/ui/monitor/ScanMonitorMenuEntry.java @@ -45,4 +45,14 @@ public Void call() throws Exception ApplicationService.createInstance(ScanMonitorApplication.NAME); return null; } + + + /** + * DO NOT CHANGE RETURN VALUE! + * @return The unique id of this {@link ToolbarEntry}. + */ + @Override + public String getId(){ + return "Scan Monitor"; + } } diff --git a/core/ui/src/main/java/org/phoebus/ui/application/ToolbarEntryService.java b/core/ui/src/main/java/org/phoebus/ui/application/ToolbarEntryService.java index e96c025ab2..9872637359 100644 --- a/core/ui/src/main/java/org/phoebus/ui/application/ToolbarEntryService.java +++ b/core/ui/src/main/java/org/phoebus/ui/application/ToolbarEntryService.java @@ -34,7 +34,7 @@ private ToolbarEntryService() { // Add specific 'desired' entry ToolbarEntry found = null; for (ToolbarEntry entry : available) - if (entry.getName().equalsIgnoreCase(desired)) + if (entry.getId().equalsIgnoreCase(desired)) { found = entry; break; diff --git a/core/ui/src/main/java/org/phoebus/ui/spi/ToolbarEntry.java b/core/ui/src/main/java/org/phoebus/ui/spi/ToolbarEntry.java index b236e712e2..d389326c6d 100644 --- a/core/ui/src/main/java/org/phoebus/ui/spi/ToolbarEntry.java +++ b/core/ui/src/main/java/org/phoebus/ui/spi/ToolbarEntry.java @@ -31,4 +31,12 @@ public default Image getIcon() { return null; } + + /** + * A unique id for the {@link ToolbarEntry}. Implementations must ensure that this + * is indeed unique and immutable. In particular, it should be insensitive to localization and + * customization of an app name. + * @return Unique id of the {@link ToolbarEntry}. + */ + String getId(); } diff --git a/core/ui/src/main/resources/phoebus_ui_preferences.properties b/core/ui/src/main/resources/phoebus_ui_preferences.properties index 929a29ffec..f4fdbd0cda 100644 --- a/core/ui/src/main/resources/phoebus_ui_preferences.properties +++ b/core/ui/src/main/resources/phoebus_ui_preferences.properties @@ -54,7 +54,11 @@ home_display=examples:/01_main.bob?app=display_runtime,Example Display # An entry starting with "!" removes that item from the available entries. # The order of the initial buttons "Home, Top Resources, Layouts" # cannot be changed, but they can be suppressed by adding "!", -# for example "Home, !Top Resources, !Layouts" +# for example "Home, !Top Resources, !Layouts". +# +# The strings in the list of entries MUST match what is returned from +# ToolbarEntry#getId(). This allows for customization/localization of app name +# without the need to adjust the list. # # Examples: #