/** * Instantiates a new adds the external resource dialog. * * @param aSection the a section * @param aExistingXRD the a existing XRD */ public AddExternalResourceDialog(AbstractSection aSection, ExternalResourceDescription aExistingXRD) { this(aSection); existingXRD = aExistingXRD; originalXrName = existingXRD.getName(); }
/** * Create an external resource binding. * * @param aKey * the key to bind to. * @param aResource * the resource to bind. * @return the description. */ public static ExternalResourceBinding createExternalResourceBinding(final String aKey, final ExternalResourceDescription aResource) { return createExternalResourceBinding(aKey, aResource.getName()); }
@Override public Object getDiscriminatorValue() { StringBuilder desc = new StringBuilder(); desc.append("["); desc.append(fullFeatureName); if (params != null && params.length > 0) { desc.append("| "); for (int i = 0; i < params.length; i++) { Object object = params[i]; if (object instanceof ExternalResourceDescription) { ExternalResourceDescription erd = (ExternalResourceDescription) object; desc.append("ExtResDesc[" + erd.getName() + "]"); } else { desc.append(object.toString()); } if (i + 1 < params.length) { desc.append(", "); } } } desc.append("]"); return desc.toString(); }
@Override public Object getDiscriminatorValue() { StringBuilder desc = new StringBuilder(); desc.append("["); desc.append(fullFeatureName); if (params != null && params.length > 0) { desc.append("| "); for (int i = 0; i < params.length; i++) { Object object = params[i]; if (object instanceof ExternalResourceDescription) { ExternalResourceDescription erd = (ExternalResourceDescription) object; desc.append("ExtResDesc[" + erd.getName() + "]"); } else { desc.append(object.toString()); } if (i + 1 < params.length) { desc.append(", "); } } } desc.append("]"); return desc.toString(); }
/** * Resource name already defined. * * @param name the name * @return true, if successful */ public boolean resourceNameAlreadyDefined(String name) { ExternalResourceDescription[] xrds = getExternalResources(); if (xrds != null) { for (int i = 0; i < xrds.length; i++) { if (xrds[i].getName().equals(name)) { Utility.popMessage("Name Already Defined", "The External Resource Name specified is already defined", MessageDialog.ERROR); return true; } } } return false; }
/** * Fill xrd item. * * @param item the item * @param xrd the xrd */ private void fillXrdItem(TreeItem item, ExternalResourceDescription xrd) { StringBuffer text = new StringBuffer(); text.append(xrd.getName()); ResourceSpecifier rs = xrd.getResourceSpecifier(); if (rs instanceof FileLanguageResourceSpecifier) { FileLanguageResourceSpecifier flrs = (FileLanguageResourceSpecifier) rs; text.append(" URL_Prefix: ").append(flrs.getFileUrlPrefix()).append(" URL_Suffix: ") .append(flrs.getFileUrlSuffix()); } else if (rs instanceof FileResourceSpecifier) { FileResourceSpecifier frs = (FileResourceSpecifier) rs; text.append(" URL: ").append(frs.getFileUrl()); } else { text.append(" Custom Resource Specifier"); } String implName = xrd.getImplementationName(); if (null != implName && !implName.equals("")) { text.append(" Implementation: ").append(implName); } item.setText(text.toString()); item.setData(xrd); }
/** * Fill bindings. * * @param parent the parent * @param xrd the xrd * @param bindings the bindings */ private void fillBindings(TreeItem parent, ExternalResourceDescription xrd, ExternalResourceBinding[] bindings) { if (null != bindings) { for (int i = 0; i < bindings.length; i++) { if (bindings[i].getResourceName().equals(xrd.getName())) { addBindingToGUI(parent, bindings[i].getKey(), bindings[i]); } } } }
String name = resources[i].getName();
ResourceManagerConfiguration delegateResMgrCfg = aeDelegate.getResourceManagerConfiguration(); for (ExternalResourceDescription res : delegateResMgrCfg.getExternalResources()) { resources.put(res.getName(), res);
xrNameUI.setText(existingXRD.getName()); xrDescriptionUI.setText(convertNull(existingXRD.getDescription())); ResourceSpecifier rs = existingXRD.getResourceSpecifier();
/** * Bind button - enabled only when one dependency is selected, and one External Resource, not * already bound to this key, is selected. */ private void handleBind() { TreeItem xrItem = tree.getSelection()[0]; if (null != xrItem.getParentItem()) xrItem = xrItem.getParentItem(); ExternalResourceDescription xrd = getXRDescriptionFromTreeItem(xrItem); TableItem keyItem = resourceDependencySection.getTable().getSelection()[0]; ExternalResourceBinding xrb = new ExternalResourceBinding_impl(); String key = keyItem.getText(ResourceDependencySection.KEY_COL); xrb.setKey(key); xrb.setResourceName(xrd.getName()); getResourceManagerConfiguration().addExternalResourceBinding(xrb); addBindingToGUI(xrItem, key, xrb); xrItem.setExpanded(true); keyItem.setText(0, "Bound"); keyItem.getParent().getColumn(0).pack(); setFileDirty(); }
TreeItem item) { valueChanged = false; xrd.setName(setValueChanged(dialog.xrName, xrd.getName())); xrd.setDescription(setValueChanged(dialog.xrDescription, xrd.getDescription())); xrd