use of org.csstudio.opibuilder.util.WidgetDescriptor in project yamcs-studio by yamcs.
the class WidgetTreeEditpart method getImage.
@Override
protected Image getImage() {
if (getWidgetModel() instanceof DisplayModel)
return super.getImage();
String typeID = getWidgetModel().getTypeID();
WidgetDescriptor widgetDescriptor = WidgetsService.getInstance().getWidgetDescriptor(typeID);
Image image = CustomMediaFactory.getInstance().getImageFromPlugin(widgetDescriptor.getPluginId(), widgetDescriptor.getIconPath());
return image;
}
use of org.csstudio.opibuilder.util.WidgetDescriptor in project yamcs-studio by yamcs.
the class OPIEditorPaletteFactory method createPaletteContents.
private static void createPaletteContents(PaletteRoot palette) {
Map<String, List<String>> categoriesMap = WidgetsService.getInstance().getAllCategoriesMap();
String[] hiddenWidgets = PreferencesHelper.getHiddenWidgets();
List<String> hiddenWidgetsList = null;
if (hiddenWidgets != null)
hiddenWidgetsList = Arrays.asList(hiddenWidgets);
for (final Map.Entry<String, List<String>> entry : categoriesMap.entrySet()) {
PaletteDrawer categoryDrawer = new PaletteDrawer(entry.getKey());
for (String typeId : entry.getValue()) {
if (hiddenWidgetsList != null && hiddenWidgetsList.indexOf(typeId) >= 0)
continue;
WidgetDescriptor widgetDescriptor = WidgetsService.getInstance().getWidgetDescriptor(typeId);
ImageDescriptor icon = CustomMediaFactory.getInstance().getImageDescriptorFromPlugin(widgetDescriptor.getPluginId(), widgetDescriptor.getIconPath());
CombinedTemplateCreationEntry widgetEntry = new CombinedTemplateCreationEntry(widgetDescriptor.getName(), widgetDescriptor.getDescription(), new WidgetCreationFactory(widgetDescriptor), icon, icon);
IGraphicalFeedbackFactory feedbackFactory = WidgetsService.getInstance().getWidgetFeedbackFactory(widgetDescriptor.getTypeID());
if (feedbackFactory != null && feedbackFactory.getCreationTool() != null) {
widgetEntry.setToolClass(feedbackFactory.getCreationTool());
}
categoryDrawer.add(widgetEntry);
}
palette.add(categoryDrawer);
}
}
Aggregations