use of com.centurylink.mdw.plugin.designer.DiscoveryException in project mdw-designer by CenturyLinkCloud.
the class MdwWorkbenchWindowAdvisor method postWindowOpen.
public void postWindowOpen() {
IWorkbenchPage activePage = Activator.getActivePage();
// check for updates
// IHandlerService handlerService = (IHandlerService)
// activePage.getWorkbenchWindow().getService(IHandlerService.class);
// try
// {
// Object result =
// handlerService.executeCommand("org.eclipse.equinox.p2.ui.sdk.update", null);
// System.out.println("result: " + result);
// if (result != null)
// System.out.println("result class: " + result.getClass().getName());
// }
// catch (Exception ex)
// {
// ex.printStackTrace();
// }
PluginMessages.log("MDW workbench startup...");
if (activePage != null) {
activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.tools");
activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.dev");
activePage.hideActionSet("com.centurylink.mdw.plugin.actionset.designerClassic");
activePage.hideActionSet("org.eclipse.ui.edit.text.actionSet.navigation");
activePage.hideActionSet("org.eclipse.ui.edit.text.actionSet.annotationNavigation");
activePage.hideActionSet("org.eclipse.ui.externaltools.ExternalToolsSet");
activePage.showActionSet("org.eclipse.search.menu");
// make sure the process explorer view is visible
try {
ProcessExplorerView processExplorerView = (ProcessExplorerView) activePage.showView("mdw.views.designer.processes");
if (mdwHost != null && mdwPort != null) {
final Shell shell = activePage.getActivePart().getSite().getShell();
BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
public void run() {
try {
discoveryException = null;
projectToImport = getWorkflowProject(mdwHost, mdwPort, mdwContextRoot);
if (projectToImport == null)
throw new DiscoveryException("Unable to discover workflow app at: " + mdwHost + ":" + mdwPort);
} catch (DiscoveryException ex) {
discoveryException = ex;
}
}
});
if (discoveryException != null)
throw discoveryException;
WorkflowProject existing = WorkflowProjectManager.getInstance().getRemoteWorkflowProject(projectToImport.getName());
if (existing != null)
WorkflowProjectManager.getInstance().deleteProject(existing);
ProgressMonitorDialog progMonDlg = new ProgressMonitorDialog(shell);
ProjectInflator projectInflator = new ProjectInflator(projectToImport, null);
projectInflator.inflateRemoteProject(progMonDlg);
ProjectImporter projectImporter = new ProjectImporter(projectToImport);
projectImporter.doImport();
processExplorerView.handleRefresh();
// handle preselected entity
if (preselectType != null && preselectType.trim().length() > 0 && preselectId != null && preselectId.trim().length() > 0) {
if (!preselectType.equals(PRESELECT_PROCESS_INSTANCE))
throw new UnsupportedOperationException("Unsupported preselect type: " + preselectType);
BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
public void run() {
// open the process instance
IWorkbenchPage page = MdwPlugin.getActivePage();
try {
WorkflowProcess instance = getProcessInstance(new Long(preselectId));
page.openEditor(instance, "mdw.editors.process");
page.showView("org.eclipse.ui.views.PropertySheet");
} catch (PartInitException ex) {
PluginMessages.uiError(ex, "Open Process Instance", projectToImport);
}
}
});
}
}
} catch (Exception ex) {
PluginMessages.uiError(ex, "Initialize Workspace");
}
}
}
use of com.centurylink.mdw.plugin.designer.DiscoveryException in project mdw-designer by CenturyLinkCloud.
the class WorkflowProjectManager method discoverWorkflowApps.
public List<WorkflowApplication> discoverWorkflowApps() throws DiscoveryException {
String urlBase = MdwPlugin.getSettings().getProjectDiscoveryUrl();
if (!urlBase.endsWith("/"))
urlBase += "/";
String ctxRoot = urlBase.endsWith("Discovery/") ? "" : "MDWWeb/";
if (urlBase.indexOf("lxdnd696") >= 0)
// old discovery server
ctxRoot = "MDWExampleWeb/";
String path = urlBase.endsWith("Discovery/") ? "ConfigManagerProjects.xml" : "Services/GetConfigFile?name=ConfigManagerProjects.xml";
String cfgMgrUrl = urlBase + ctxRoot + path;
try {
URL url = new URL(cfgMgrUrl);
HttpHelper httpHelper = new HttpHelper(url);
httpHelper.setConnectTimeout(MdwPlugin.getSettings().getHttpConnectTimeout());
httpHelper.setReadTimeout(MdwPlugin.getSettings().getHttpReadTimeout());
String xml = httpHelper.get();
ConfigManagerProjectsDocument doc = ConfigManagerProjectsDocument.Factory.parse(xml, Compatibility.namespaceOptions());
return doc.getConfigManagerProjects().getWorkflowAppList();
} catch (XmlException ex) {
PluginMessages.log(ex);
throw new DiscoveryException("Unable to obtain/parse Config Manager info from " + cfgMgrUrl);
} catch (Exception ex) {
throw new DiscoveryException(ex.getMessage(), ex);
}
}
Aggregations