use of com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater in project mdw-designer by CenturyLinkCloud.
the class LocalCloudProjectWizard method performFinish.
@Override
public boolean performFinish() {
// can depend on
project.setDefaultFilesToIgnoreDuringUpdate();
// container selected
ProjectInflator projectInflator = new ProjectInflator(project, MdwPlugin.getSettings());
if (project.checkRequiredVersion(6, 0, 3))
projectInflator.inflateCliCloudProject();
else
projectInflator.inflateCloudProject(getContainer());
WorkflowProjectManager.addProject(project);
// take care of any extension modules
ExtensionModulesUpdater changer = new ExtensionModulesUpdater(getProject());
changer.setAdds(project.getExtensionModules());
changer.doChanges(getShell());
if (!project.isRemote() && !project.isWar()) {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
// deployment assembly, and add the resources folder
try {
ProjectConfigurator projConf = new ProjectConfigurator(getProject(), MdwPlugin.getSettings());
getProject().getSourceProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
if (getProject().isFilePersist())
projConf.removeDeploymentAssemblyResourceMappings(project.getAssetFolder());
else
projConf.removeDeploymentAssemblyResourceMappings(project.getTempFolder());
projConf.addDeploymentAssemblyResourceMappings(project.getSourceProject().getFolder("/src/main/resources"));
} catch (CoreException ex) {
PluginMessages.uiError(ex, "Inflate Project", getProject());
}
}
});
}
DesignerPerspective.promptForShowPerspective(activeWindow, project);
return true;
}
use of com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater in project mdw-designer by CenturyLinkCloud.
the class ProjectSettingsPropertyPage method performOk.
public boolean performOk() {
IProject project = (IProject) getElement();
try {
WorkflowProjectManager.getInstance().save(getProject(), project);
} catch (CoreException ex) {
PluginMessages.uiError(getShell(), ex, "Project Settings", getProject());
return false;
}
if (getProject().getPersistType() == PersistType.Git && (!gitRepositoryUrlTextField.getText().trim().equals(originalGitRepositoryUrl) || !gitBranchTextField.getText().trim().equals(originalGitBranch) || !assetLocalPathTextField.getText().trim().equals(originalAssetLocalPath) || (includeArchiveCheckbox != null && includeArchiveCheckbox.getSelection() != originalIncludeArchive))) {
getProject().getMdwVcsRepository().setEntrySource("projectSettingsPropertyPage");
getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getMdwVcsRepository());
}
if (databaseJdbcUrlTextField != null && !databaseJdbcUrlTextField.getText().trim().equals(originalJdbcUrl)) {
getProject().getMdwDataSource().setEntrySource("projectSettingsPropertyPage");
getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getMdwDataSource());
}
if (mdwVersionComboBox != null && !mdwVersionComboBox.getText().equals(originalMdwVersion)) {
getProject().fireElementChangeEvent(ChangeType.VERSION_CHANGE, getProject().getMdwVersion());
if (MessageDialog.openQuestion(getShell(), "Update Framework Libraries", "The MDW version has changed. Would you like to download updated framework libraries to match the new selection?")) {
ProjectUpdater updater = new ProjectUpdater(getProject(), MdwPlugin.getSettings());
try {
updater.updateFrameworkJars(null);
ExtensionModulesUpdater modulesUpdater = new ExtensionModulesUpdater(getProject());
modulesUpdater.doUpdate(getShell());
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Update Framework Libraries", getProject());
return false;
}
}
if (getProject().isOsgi())
MessageDialog.openInformation(getShell(), "MDW Version Changed", "The MDW version has been updated in the plug-in settings file. Please update any MDW dependencies in your pom.xml build file.");
}
if (getProject().isRemote()) {
if (!hostTextField.getText().trim().equals(originalHost) || !portTextField.getText().trim().equals(String.valueOf(originalPort))) {
getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getServerSettings());
}
if (!contextRootTextField.getText().trim().equals(originalContextRoot)) {
getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getWebContextRoot());
}
if (syncSwitch != null && syncSwitch.getSelection() != originalSync) {
WorkflowProjectManager.getInstance().makeLocal(getProject());
getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().getMdwVcsRepository());
MessageDialog.openInformation(getShell(), "Remote Project Unlocked", getProject().getName() + " has been unlocked. Please close any open assets and refresh.");
}
}
if (updateServerCacheCheckbox.getSelection() != originalRefreshServerCache)
getProject().fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, getProject().isUpdateServerCache());
return true;
}
use of com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater 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;
}
use of com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater in project mdw-designer by CenturyLinkCloud.
the class ProjectSection method setSelection.
@Override
public void setSelection(WorkflowElement selection) {
if (project != null)
project.removeElementChangeListener(this);
project = (WorkflowProject) selection;
project.addElementChangeListener(this);
// dispose controls to render dynamically
if (sourceProjectEditor != null)
sourceProjectEditor.dispose();
if (jdbcUrlEditor != null)
jdbcUrlEditor.dispose();
if (hostEditor != null)
hostEditor.dispose();
if (portEditor != null)
portEditor.dispose();
if (webContextRootEditor != null)
webContextRootEditor.dispose();
if (updateServerCacheEditor != null)
updateServerCacheEditor.dispose();
if (localProjectEditor != null)
localProjectEditor.dispose();
if (localProjectInfoEditor != null)
localProjectInfoEditor.dispose();
if (mdwVersionEditor != null)
mdwVersionEditor.dispose();
if (appVersionEditor != null)
appVersionEditor.dispose();
// source project text field
sourceProjectEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
sourceProjectEditor.setLabel("Source Project");
sourceProjectEditor.setWidth(200);
sourceProjectEditor.render(composite);
sourceProjectEditor.setValue(project.getSourceProjectName());
sourceProjectEditor.setEditable(false);
if (!project.checkRequiredVersion(6, 0)) {
// jdbc url text field
jdbcUrlEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
jdbcUrlEditor.setLabel("JDBC URL");
jdbcUrlEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getMdwDataSource().setJdbcUrlWithCredentials(((String) newValue).trim());
project.getMdwDataSource().setEntrySource("projectSection");
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwDataSource());
}
});
jdbcUrlEditor.render(composite);
jdbcUrlEditor.setValue(project.getMdwDataSource().getJdbcUrlWithMaskedCredentials());
jdbcUrlEditor.setEditable(!project.isReadOnly());
}
// host text field
hostEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
hostEditor.setLabel("Server Host");
hostEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getServerSettings().setHost((String) newValue);
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getServerSettings());
}
});
hostEditor.render(composite);
hostEditor.setValue(project.getServerSettings().getHost());
hostEditor.setEditable(!project.isReadOnly());
// port text field
portEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
portEditor.setLabel("Server Port");
portEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getServerSettings().setPort(Integer.parseInt(((String) newValue).trim()));
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getServerSettings());
}
});
portEditor.render(composite);
portEditor.setValue(project.getServerSettings().getPort());
portEditor.setEditable(!project.isReadOnly());
// web context root text field
webContextRootEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
webContextRootEditor.setLabel("Web Context Root");
webContextRootEditor.setWidth(200);
if (project.isRemote()) {
webContextRootEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.setWebContextRoot(((String) newValue).trim());
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getServerSettings());
}
});
}
webContextRootEditor.render(composite);
webContextRootEditor.setValue(project.getWebContextRoot());
webContextRootEditor.setEditable(!project.isReadOnly() && project.isRemote());
// refresh server cache checkbox
updateServerCacheEditor = new PropertyEditor(project, PropertyEditor.TYPE_CHECKBOX);
updateServerCacheEditor.setLabel("Update Server Cache");
updateServerCacheEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.setUpdateServerCache(Boolean.parseBoolean(newValue.toString()));
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.isUpdateServerCache());
}
});
updateServerCacheEditor.render(composite);
updateServerCacheEditor.setValue(project.isUpdateServerCache());
updateServerCacheEditor.setEditable(!project.isReadOnly());
// mdw version combo
if (project.isRemote()) {
mdwVersionEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
} else {
mdwVersionEditor = new PropertyEditor(project, PropertyEditor.TYPE_COMBO);
String releaseUrl = mdwSettings.getMdwReleasesUrl();
if (project.getMdwMajorVersion() < 6)
mdwSettings.setMdwReleasesUrl(mdwSettings.getInternalRepositoryUrl());
List<String> versionOptions = mdwSettings.getMdwVersions();
mdwSettings.setMdwReleasesUrl(releaseUrl);
if (!versionOptions.contains(project.getMdwVersion()))
versionOptions.add(project.getMdwVersion());
mdwVersionEditor.setValueOptions(versionOptions);
mdwVersionEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
if (!project.isRemote() && !newValue.equals("")) {
project.setMdwVersion((String) newValue);
WorkflowProjectManager.updateProject(project);
if (MessageDialog.openQuestion(getShell(), "Update Framework Libraries", "Download updated framework libraries to match MDW Version selection?")) {
ProjectUpdater updater = new ProjectUpdater(getProject(), MdwPlugin.getSettings());
try {
updater.updateFrameworkJars(null);
ExtensionModulesUpdater modulesUpdater = new ExtensionModulesUpdater(getProject());
modulesUpdater.doUpdate(getShell());
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Update Framework Libraries", getProject());
}
}
if (getProject().isOsgi())
MessageDialog.openInformation(getShell(), "MDW Version Changed", "The MDW version has been updated in the plug-in settings file. Please update any MDW dependencies in your pom.xml build file.");
}
}
});
}
mdwVersionEditor.setLabel("MDW Version");
mdwVersionEditor.setWidth(100);
mdwVersionEditor.render(composite);
mdwVersionEditor.setValue(project.getMdwVersion());
mdwVersionEditor.setEditable(!project.isReadOnly() && !project.isRemote());
// app version
if (!project.isCloudProject() && !"Unknown".equals(project.getAppVersion())) {
appVersionEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
appVersionEditor.setLabel("App Version");
appVersionEditor.setWidth(200);
appVersionEditor.render(composite);
appVersionEditor.setValue(project.getAppVersion());
appVersionEditor.setEditable(false);
}
if (!project.isRemote()) {
// local project text field
localProjectEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
localProjectEditor.setLabel("Workspace Project");
localProjectEditor.setWidth(200);
localProjectEditor.setReadOnly(true);
localProjectEditor.render(composite);
if (project.isCloudProject())
localProjectEditor.setValue(project.getSourceProjectName());
else
localProjectEditor.setValue(project.getEarProjectName());
if (!project.isOsgi()) {
// local project info field
localProjectInfoEditor = new PropertyEditor(project, PropertyEditor.TYPE_LINK);
localProjectInfoEditor.setLabel("Workspace Project Settings");
localProjectInfoEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
final IProject proj = project.isCloudProject() ? project.getSourceProject() : project.getEarProject();
PropertyDialog dialog = PropertyDialog.createDialogOn(getShell(), "mdw.workflow.mdwServerConnectionsPropertyPage", proj);
if (dialog != null)
dialog.open();
}
});
localProjectInfoEditor.render(composite);
}
}
composite.layout(true);
}
use of com.centurylink.mdw.plugin.project.assembly.ExtensionModulesUpdater in project mdw-designer by CenturyLinkCloud.
the class ProjectUpdateAction method run.
/**
* @see IActionDelegate#run(IAction)
*/
public void run(final IAction action) {
IProject project = null;
WorkflowProject workflowProject = null;
try {
if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).getFirstElement() instanceof IProject) {
project = (IProject) ((IStructuredSelection) selection).getFirstElement();
workflowProject = WorkflowProjectManager.getInstance().getWorkflowProject(project);
}
if (workflowProject == null) {
MessageDialog.openError(shell, "MDW Update", "Selection must be a Workflow project.");
return;
}
final ProjectUpdater updater = new ProjectUpdater(workflowProject, MdwPlugin.getSettings());
if (action.getId().equals("mdw.workflow.updateFrameworkJars")) {
updater.updateFrameworkJars(null);
ExtensionModulesUpdater modulesUpdater = new ExtensionModulesUpdater(workflowProject);
modulesUpdater.doUpdate(shell);
} else if (action.getId().equals("mdw.workflow.associateFrameworkSourceCode")) {
ProgressMonitorDialog pmDialog = new MdwProgressMonitorDialog(shell);
final WorkflowProject wfProject = workflowProject;
pmDialog.run(true, false, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
monitor.beginTask("Setting Java source attachment locations", 100);
monitor.worked(20);
ProjectConfigurator configurator = new ProjectConfigurator(wfProject, MdwPlugin.getSettings());
try {
configurator.createFrameworkSourceCodeAssociations(shell, monitor);
} catch (CoreException ex) {
PluginMessages.log(ex);
}
}
});
}
} catch (Exception ex) {
PluginMessages.log(ex);
}
}
Aggregations