use of com.centurylink.mdw.plugin.project.extensions.ExtensionModule in project mdw-designer by CenturyLinkCloud.
the class WorkflowProjectManager method getAllExtensions.
private List<ExtensionModule> getAllExtensions() {
if (allExtensions == null) {
allExtensions = new ArrayList<ExtensionModule>();
// read the plug-in extensions
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = registry.getExtensionPoint("com.centurylink.mdw.designer.ui.extensionModules");
IExtension[] extensions = extensionPoint.getExtensions();
for (IExtension extension : extensions) {
for (IConfigurationElement element : extension.getConfigurationElements()) {
try {
ExtensionModule module = (ExtensionModule) element.createExecutableExtension("class");
module.setId(element.getAttribute("id"));
module.setName(element.getAttribute("name"));
module.setDescription(element.getAttribute("description"));
// null
module.setVersion(element.getAttribute("version"));
// means
// MDW
// version
String requiredMdwVersion = element.getAttribute("requiredMdwVersion");
if (requiredMdwVersion != null)
// null
module.setRequiredMdwVersion(requiredMdwVersion);
// means
// any
// >=
// 5.1
allExtensions.add(module);
} catch (Exception ex) {
PluginMessages.log("Unable to load MDW Extension for element: " + element);
PluginMessages.log(ex);
}
}
}
}
Collections.sort(allExtensions);
return allExtensions;
}
use of com.centurylink.mdw.plugin.project.extensions.ExtensionModule in project mdw-designer by CenturyLinkCloud.
the class ExtensionModulesWizardPage method drawWidgets.
/**
* draw the widgets using a grid layout
*
* @param parent
* - the parent composite
*/
public void drawWidgets(Composite parent) {
// create the composite to hold the widgets
Composite composite = new Composite(parent, SWT.NULL);
// create the layout for this wizard page
GridLayout gl = new GridLayout();
int ncol = 4;
gl.numColumns = ncol;
composite.setLayout(gl);
extensionsTable = new ExtensionModulesTable(getProject());
extensionsTable.create();
extensionsTable.getTableEditor().render(composite, false);
extensionsTable.setSelectedModules(new ArrayList<ExtensionModule>());
extensionsTable.getTableEditor().addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
getProject().setExtensionModules(extensionsTable.getSelectedModules());
}
});
setControl(composite);
}
use of com.centurylink.mdw.plugin.project.extensions.ExtensionModule in project mdw-designer by CenturyLinkCloud.
the class ProjectPersist method toXml.
public String toXml() {
StringBuffer sb = new StringBuffer();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
sb.append("<mdw-workflow>\n");
sb.append(" <sourceProject name=\"" + workflowProject.getSourceProjectName() + "\" author=\"" + workflowProject.getAuthor() + "\"");
if (workflowProject.isProduction())
sb.append(" production=\"true\"");
sb.append("/>\n");
for (ExtensionModule extension : workflowProject.getExtensionModules()) {
String extensionElementText = extension.writeConfigElement(workflowProject);
if (extensionElementText != null)
sb.append(extensionElementText);
}
if (// remote projects get version
!workflowProject.isRemote())
// dynamically from server
sb.append(" <mdwFramework version=\"" + workflowProject.getMdwVersion() + "\"/>\n");
ServerSettings serverSettings = workflowProject.getServerSettings();
sb.append(" <server host=\"" + serverSettings.getHost() + "\" port=\"" + serverSettings.getPort() + "\"");
if (!StringHelper.isEmpty(workflowProject.getWebContextRoot()))
sb.append(" contextRoot=\"" + workflowProject.getWebContextRoot() + "\"");
else {
sb.append(" contextRoot=\"mdw\"");
}
sb.append("/>\n");
if (workflowProject.getPersistType() == PersistType.Git) {
sb.append(" <repository");
VcsRepository repo = workflowProject.getMdwVcsRepository();
sb.append(" provider=\"" + repo.getProvider() + "\"");
if (repo.getRepositoryUrl() != null && repo.getRepositoryUrl().trim().length() > 0)
sb.append(" url=\"").append(repo.getRepositoryUrlWithEncryptedCredentials() + "\"");
if (repo.getBranch() != null && repo.getBranch().trim().length() > 0)
sb.append(" branch=\"").append(repo.getBranch() + "\"");
if (repo.getLocalPath() != null && repo.getLocalPath().trim().length() > 0)
sb.append(" localPath=\"").append(repo.getLocalPath().replace("\\", "/") + "\"");
if (repo.getPkgPrefixes() != null && !repo.getPkgPrefixes().isEmpty()) {
sb.append(" pkgPrefixes=\"");
for (int i = 0; i < repo.getPkgPrefixes().size(); i++) {
String prefix = repo.getPkgPrefixes().get(i).trim();
sb.append(prefix);
if (i < repo.getPkgPrefixes().size() - 1)
sb.append(",");
}
sb.append("\"");
}
sb.append("/>\n");
}
if (!workflowProject.checkRequiredVersion(6, 0)) {
if (workflowProject.getPersistType() != PersistType.None) {
sb.append(" <database jdbcUrl=\"" + workflowProject.getMdwDataSource().getJdbcUrlWithEncryptedCredentials() + "\"");
if (workflowProject.getMdwDataSource().getSchemaOwner() != null)
sb.append(" schemaOwner=\"" + workflowProject.getMdwDataSource().getSchemaOwner() + "\"");
sb.append("/>\n");
}
if (workflowProject.getFilesToIgnore() != null)
sb.append(" <filesToIgnore duringUpdate=\"" + workflowProject.getFilesToIgnoreDuringUpdate() + "\"/>\n");
}
sb.append("</mdw-workflow>\n");
return sb.toString();
}
use of com.centurylink.mdw.plugin.project.extensions.ExtensionModule in project mdw-designer by CenturyLinkCloud.
the class ExtensionModulesPropertyPage method createContents.
@Override
protected Control createContents(Composite parent) {
noDefaultAndApplyButton();
initializeWorkflowProject();
Composite composite = createComposite(parent);
extensionsTable = new ExtensionModulesTable(getProject());
extensionsTable.create();
extensionsTable.getTableEditor().render(composite, false);
existingModules = getProject().getExtensionModules();
List<ExtensionModule> selectedModules = new ArrayList<>();
selectedModules.addAll(existingModules);
extensionsTable.setSelectedModules(selectedModules);
return composite;
}
use of com.centurylink.mdw.plugin.project.extensions.ExtensionModule in project mdw-designer by CenturyLinkCloud.
the class ExtensionModulesPropertyPage method performOk.
@Override
public boolean performOk() {
List<ExtensionModule> selectedModules = extensionsTable.getSelectedModules();
// check for deltas
List<ExtensionModule> adds = new ArrayList<>();
for (ExtensionModule selected : selectedModules) {
if (!existingModules.contains(selected))
adds.add(selected);
}
List<ExtensionModule> removes = new ArrayList<>();
for (ExtensionModule existing : existingModules) {
if (!selectedModules.contains(existing))
removes.add(existing);
}
ExtensionModulesUpdater changer = new ExtensionModulesUpdater(getProject());
changer.setAdds(adds);
changer.setRemoves(removes);
changer.doChanges(getShell());
return true;
}
Aggregations