Skip to content

Commit

Permalink
Merge pull request #3163 from ControlSystemStudio/CSSTUDIO-2650
Browse files Browse the repository at this point in the history
Toolbar entry for Logbook
  • Loading branch information
shroffk authored Oct 11, 2024
2 parents 30b6a1d + 7dcc0ad commit f33eeb3
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
import org.phoebus.framework.spi.AppResourceDescriptor;
import org.phoebus.logbook.*;
import org.phoebus.ui.javafx.ImageCache;
import org.phoebus.util.text.Strings;

import java.net.URI;
import java.util.logging.Logger;

public class LogEntryTableApp implements AppResourceDescriptor {

public static final Logger logger = Logger.getLogger(LogEntryTableApp.class.getName());
static final Image icon = ImageCache.getImage(LogEntryTableApp.class, "/icons/logbook-16.png");
public static final Image icon = ImageCache.getImage(LogEntryTableApp.class, "/icons/logbook-16.png");
public static final String NAME = "logEntryTable";
public static String DISPLAYNAME = "Log Entry Table";
public static String DISPLAY_NAME = Messages.Logbook;

private static final String SUPPORTED_SCHEMA = "logbook";
private LogFactory logFactory;
Expand All @@ -25,15 +24,11 @@ public class LogEntryTableApp implements AppResourceDescriptor {
@Override
public void start() {
logFactory = LogService.getInstance().getLogFactories().get(LogbookPreferences.logbook_factory);
String displayName = LogbookUIPreferences.log_entry_table_display_name;
if(!Strings.isNullOrEmpty(displayName)){
DISPLAYNAME = displayName;
}
}

@Override
public String getDisplayName() {
return DISPLAYNAME;
return DISPLAY_NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public Void call() throws Exception
@Override
public String getName()
{
return LogEntryTableApp.DISPLAYNAME;
return LogEntryTableApp.DISPLAY_NAME;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class LogbookUIPreferences
@Preference public static boolean log_entry_groups_support;
@Preference public static boolean log_entry_update_support;
@Preference public static String[] hidden_properties;
@Preference public static String log_entry_table_display_name;
@Preference public static String log_entry_calendar_display_name;
@Preference public static String log_attribute_desc;
@Preference public static int search_result_page_size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public class Messages
GroupingFailed,
GroupSelectedEntries,
Level,
Logbook,
LogbookNotSupported,
LogbooksSearchFailTitle,
LogbookServiceUnavailableTitle,
LogbookServiceHasNoLogbooks,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2024 European Spallation Source ERIC.
*/

package org.phoebus.logbook.olog.ui.menu;

import javafx.scene.image.Image;
import org.phoebus.framework.workbench.ApplicationService;
import org.phoebus.logbook.LogbookPreferences;
import org.phoebus.logbook.olog.ui.LogEntryTableApp;
import org.phoebus.logbook.olog.ui.Messages;
import org.phoebus.ui.dialog.ExceptionDetailsErrorDialog;
import org.phoebus.ui.spi.ToolbarEntry;

public class LogEntryTableToolbarEntry implements ToolbarEntry {

@Override
public Void call() throws Exception
{
if (LogbookPreferences.is_supported){
ApplicationService.createInstance(LogEntryTableApp.NAME);
}
else{
ExceptionDetailsErrorDialog.openError(Messages.LogbookNotSupported, Messages.LogbookNotSupported, new Exception("No logbook factory found"));
}
return null;
}

@Override
public String getName()
{
return LogEntryTableApp.DISPLAY_NAME;
}

@Override
public Image getIcon()
{
return LogEntryTableApp.icon;
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.phoebus.logbook.olog.ui.menu.SendToLogBookToolbarEntry
org.phoebus.logbook.olog.ui.menu.SendToLogBookToolbarEntry
org.phoebus.logbook.olog.ui.menu.LogEntryTableToolbarEntry
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ log_entry_update_support=true
# business logic, but should not be rendered in the properties view.
hidden_properties=Log Entry Group

# Log Entry Table display name. If non-empty it overrides default "Log Entry Table"
log_entry_table_display_name=

# Log Entry Calendar display name. If non-empty it overrides default "Log Entry Calendar"
log_entry_calendar_display_name=

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ HitsPerPage=Hits per page:
ImageWidth=Width
ImageHeight=Height
Level=Level
Logbook=Logbook
Logbooks=Logbooks:
LogbookNotSupported=No Logbook Support
LogbookServiceUnavailableTitle=Cannot create logbook entry
LogbookServiceHasNoLogbooks=Logbook service "{0}" has no logbooks or is not available.
LogbooksSearchFailTitle=Logbook Search Error
Expand Down

0 comments on commit f33eeb3

Please sign in to comment.