use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.
the class DirectoryWatcherService method getCompQName.
private String getCompQName(String compName) {
MobileApplication mobileApplication = project.getMobileApplication();
ApplicationComponent app = (ApplicationComponent) mobileApplication.getApplicationComponent();
for (UISharedComponent uisc : app.getSharedComponentList()) {
if (compName.equals(uisc.getName().toLowerCase())) {
return uisc.getQName();
}
}
return null;
}
use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.
the class Ionic3Builder method updateSourceFiles.
private void updateSourceFiles() throws EngineException {
try {
MobileApplication mobileApplication = project.getMobileApplication();
if (mobileApplication != null) {
ApplicationComponent application = (ApplicationComponent) mobileApplication.getApplicationComponent();
if (application != null) {
String appTplVersion = application.requiredTplVersion();
if (compareVersions(tplVersion, appTplVersion) >= 0) {
for (PageComponent page : getEnabledPages(application)) {
writePageSourceFiles(page);
}
writeAppSourceFiles(application);
removeUselessPages(application);
Engine.logEngine.trace("(MobileBuilder) Application source files updated for ionic project '" + project.getName() + "'");
} else {
cleanDirectories();
throw new EngineException("Template project minimum " + appTplVersion + " is required for this project.\n" + "You can change template by configuring the 'Template project' property of your project's 'Application' object.\n" + "Then, be sure to update the project node modules packages (Application Right Click->Update packages and execute) \n");
}
}
}
} catch (EngineException e) {
throw e;
} catch (Exception e) {
throw new EngineException("Unable to update application source files for ionic project '" + project.getName() + "'", e);
}
}
use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.
the class NgxBuilder method updateConsumers.
private void updateConsumers(Project to) {
MobileApplication mobileApplication = project.getMobileApplication();
ApplicationComponent app = (ApplicationComponent) mobileApplication.getApplicationComponent();
for (UISharedComponent uisc : app.getSharedComponentList()) {
updateConsumers(uisc, to);
}
}
use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.
the class NgxBuilder method addComp.
private void addComp(UISharedComponent comp) throws EngineException {
MobileApplication mobileApplication = project.getMobileApplication();
if (mobileApplication != null) {
ApplicationComponent application = (ApplicationComponent) mobileApplication.getApplicationComponent();
if (application != null) {
writeCompSourceFiles(comp);
writeAppSourceFiles(application);
}
}
}
use of com.twinsoft.convertigo.beans.core.MobileApplication in project convertigo by convertigo.
the class BuildLocallyAction method build.
/**
* Function which made the build
* @param option
* @param run
* @param target
*/
public void build(final String option, final boolean run, final String target) {
Cursor waitCursor = null;
if (parentShell != null) {
waitCursor = new Cursor(ConvertigoPlugin.getDisplay(), SWT.CURSOR_WAIT);
parentShell.setCursor(waitCursor);
}
try {
if (mobilePlatform != null) {
// Check endpoint url is empty or not
MobileApplication mobileApplication = mobilePlatform.getObject().getParent();
String[] exEndpoint = { mobileApplication.getEndpoint() };
String[] curEndpoint = { exEndpoint[0] };
try {
MobileApplicationEndpointEditorComposite[] mob = new MobileApplicationEndpointEditorComposite[1];
Dialog dialog = new Dialog(parentShell) {
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, "Build (temporary end point)", true);
createButton(parent, IDialogConstants.FINISH_ID, "Build (permanent end point)", false);
createButton(parent, IDialogConstants.CANCEL_ID, "Cancel Build", false);
}
@Override
protected void buttonPressed(int buttonId) {
super.buttonPressed(buttonId);
if (IDialogConstants.FINISH_ID == buttonId) {
setReturnCode(buttonId);
close();
}
}
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
mob[0] = new MobileApplicationEndpointEditorComposite(composite, SWT.NONE, mobileApplication);
return composite;
}
};
int code = dialog.open();
if (code == Dialog.OK || code == IDialogConstants.FINISH_ID) {
curEndpoint[0] = mob[0].getValue();
} else {
return;
}
if (code == IDialogConstants.FINISH_ID) {
String s = mobileApplication.getEndpoint();
if (!s.equals(curEndpoint[0])) {
mobileApplication.setEndpoint(curEndpoint[0]);
mobilePlatform.getParentDatabaseObjectTreeObject().hasBeenModified(true);
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
ConvertigoPlugin.getDisplay().asyncExec(() -> {
explorerView.viewer.refresh(mobilePlatform.getProjectTreeObject(), true);
});
}
}
exEndpoint[0] = null;
}
} catch (Exception e) {
}
if (curEndpoint[0].equals("")) {
if (parentShell != null) {
MessageBox informDialog = new MessageBox(parentShell, SWT.ICON_INFORMATION | SWT.OK);
informDialog.setText("Endpoint URL is empty");
informDialog.setMessage("You need to have an endpoint URL to continue the local build.\n" + "Please enter a valid endpoint URL in the property \"Convertigo server endpoint\" present on \"" + mobileApplication.getName() + "\" object.");
informDialog.open();
} else {
// TODO
}
return;
}
IApplicationComponent app = mobileApplication.getApplicationComponent();
String msg = app != null ? app.getUnbuiltMessage() : null;
if (msg != null && parentShell != null) {
MessageBox informDialog = new MessageBox(parentShell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
informDialog.setText("Application not ready");
informDialog.setMessage(msg + "\nThen launch the Local Build again.\n" + "Do you want to build now anyway?");
int result = informDialog.open();
if (result == SWT.NO) {
return;
}
}
// OK we are sure we have a Cordova environment.. Start the build
Job buildJob = new Job("Local Cordova Build " + (run ? "and Run " : "") + "in progress...") {
@Override
protected IStatus run(IProgressMonitor progressMonitor) {
BuildLocally.Status status = buildLocally.installCordova();
if (status == BuildLocally.Status.CANCEL) {
return org.eclipse.core.runtime.Status.CANCEL_STATUS;
}
try {
mobileApplication.setEndpoint(curEndpoint[0]);
status = buildLocally.runBuild(option, run, target);
if (status == BuildLocally.Status.OK) {
return org.eclipse.core.runtime.Status.OK_STATUS;
}
return org.eclipse.core.runtime.Status.CANCEL_STATUS;
} finally {
if (exEndpoint[0] != null) {
mobileApplication.setEndpoint(exEndpoint[0]);
}
}
}
@Override
protected void canceling() {
buildLocally.cancelBuild(run);
}
};
buildJob.setUser(true);
buildJob.schedule();
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to build locally with Cordova");
} finally {
parentShell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations