/** * Returns the display name of this element. By default, the definition name is returned, but * subclasses may override this to return some other name suitable for display in the design UI. * * @return The display name. */ public String getDisplayName() { return getDefinition().getName(); }
@Override public void setDefinition(PluginDefinition definition) { if (definition != null && def == null) { def = new PluginDefinition(definition); layoutName = def.getName(); String category = def.getCategory(); shared = category != null && category.contains("Shared"); super.setDefinition(def); } }
/** * Registers the plugin with the specified definition with the specified path. If a tree path is * absent, the plugin is associated with the tab itself. * * @param path Format is <tab name>\<tree node path> * @param def Plugin definition * @param propertySource Optional source for retrieving property values. * @return The newly created plugin. * @throws Exception Unspecified exception. */ public ElementBase register(String path, PluginDefinition def, IPropertyProvider propertySource) throws Exception { if (def.isForbidden()) { log.info("Access to plugin " + def.getName() + " is restricted."); return null; } if (def.isDisabled()) { log.info("Plugin " + def.getName() + " is disabled."); return null; } ElementBase parent = parentFromPath(path); ElementBase plugin = parent == null ? null : def.createElement(parent, propertySource, false); String defPluginId = getDefaultPluginId(); if (plugin instanceof ElementUI && !defPluginId.isEmpty() && (defPluginId.equalsIgnoreCase(def.getId()) || defPluginId.equalsIgnoreCase(def.getName()))) { ((ElementUI) plugin).activate(true); } return plugin; }
public AboutParams(PluginDefinition def) { super(); title = def.getName(); source = def.getSource(); icon = def.getIcon(); description = def.getDescription(); set("name", def.getName()); set("version", def.getVersion()); set("creator", def.getCreator()); set("copyright", def.getCopyright()); set("release", def.getReleased()); }
shell.register("Test Harness\\" + plugin.getName(), plugin);
/** * Apply/remove the design context menu to/from the specified component. If applying the design * context menu, any existing context menu is saved. When removing the context menu, any saved * context menu is restored. * * @param component Component to which to apply/remove the design context menu. * @param contextMenu The design menu if design mode is activated, or null if it is not. */ protected void setDesignContextMenu(BaseUIComponent component, Menupopup contextMenu) { component.setAttribute(CONTEXT_MENU, contextMenu); if (contextMenu == null) { SavedState.restore(component); applyHint(); } else { new SavedState(component); component.setContext(contextMenu); component.setHint(getDefinition().getName()); } }
String path = category + (category.endsWith("\\") ? "" : "\\") + def.getName(); boolean isFavorite = other != null || (favorites != null && favorites.contains(path)); boolean disabled = def.isDisabled() || def.isForbidden();
@Test public void parserTest() throws Exception { String xml = MockTest.getTextFromResource("pluginDefinition.xml"); PluginDefinition def = PluginXmlParser.fromXml(xml); assertEquals("Test1", def.getName()); assertEquals("plugin-test", def.getId()); assertEquals(def.getResources().size(), 4); assertTrue(def.getResources().get(0) instanceof PluginResourceButton); assertTrue(def.getResources().get(1) instanceof PluginResourceButton); assertTrue(def.getResources().get(2) instanceof PluginResourceHelp); assertTrue(def.getResources().get(3) instanceof PluginResourcePropertyGroup); }
StrUtil.formatMessage("@cwf.shell.designer.add.component.title", parentElement.getDefinition().getName())); window.setOnCanClose(() -> { if (favoritesChanged) {