use of com.twinsoft.convertigo.beans.ngx.components.UIDynamicInvoke in project convertigo by convertigo.
the class NgxUIComponentTreeObject method handlesBeanNameChanged.
protected void handlesBeanNameChanged(TreeObjectEvent treeObjectEvent) {
DatabaseObjectTreeObject treeObject = (DatabaseObjectTreeObject) treeObjectEvent.getSource();
DatabaseObject databaseObject = (DatabaseObject) treeObject.getObject();
Object oldValue = treeObjectEvent.oldValue;
Object newValue = treeObjectEvent.newValue;
int update = treeObjectEvent.update;
if (update != TreeObjectEvent.UPDATE_NONE) {
// Case a UIStackVariable has been renamed
if (databaseObject instanceof UIStackVariable) {
UIStackVariable variable = (UIStackVariable) databaseObject;
UIActionStack stack = variable.getSharedAction();
if (stack != null) {
// rename variable for InvokeAction
if (getObject() instanceof UIDynamicInvoke) {
UIDynamicInvoke udi = (UIDynamicInvoke) getObject();
if (udi.getSharedActionQName().equals(stack.getQName())) {
boolean isLocalProject = variable.getProject().equals(udi.getProject());
boolean isSameValue = variable.getName().equals(oldValue);
boolean shouldUpdate = (update == TreeObjectEvent.UPDATE_ALL) || ((update == TreeObjectEvent.UPDATE_LOCAL) && (isLocalProject));
if (!isSameValue && shouldUpdate) {
Iterator<UIComponent> it = udi.getUIComponentList().iterator();
while (it.hasNext()) {
UIComponent component = (UIComponent) it.next();
if (component instanceof UIControlVariable) {
UIControlVariable uicv = (UIControlVariable) component;
if (uicv.getName().equals(oldValue)) {
try {
uicv.setName((String) newValue);
uicv.hasChanged = true;
viewer.refresh();
markMainAsDirty(udi);
notifyDataseObjectPropertyChanged(uicv, "name", oldValue, newValue, new HashSet<Object>());
break;
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Unable to refactor the references of '" + newValue + "' variable for InvokeAction !");
}
}
}
}
}
}
}
}
}
// Case a UICompVariable has been renamed
if (databaseObject instanceof UICompVariable) {
UICompVariable variable = (UICompVariable) databaseObject;
UISharedComponent comp = variable.getSharedComponent();
if (comp != null) {
// rename variable for UseShared
if (getObject() instanceof UIUseShared) {
UIUseShared uus = (UIUseShared) getObject();
if (uus.getSharedComponentQName().equals(comp.getQName())) {
boolean isLocalProject = variable.getProject().equals(uus.getProject());
boolean isSameValue = variable.getName().equals(oldValue);
boolean shouldUpdate = (update == TreeObjectEvent.UPDATE_ALL) || ((update == TreeObjectEvent.UPDATE_LOCAL) && (isLocalProject));
if (!isSameValue && shouldUpdate) {
Iterator<UIComponent> it = uus.getUIComponentList().iterator();
while (it.hasNext()) {
UIComponent component = (UIComponent) it.next();
if (component instanceof UIControlVariable) {
UIControlVariable uicv = (UIControlVariable) component;
if (uicv.getName().equals(oldValue)) {
try {
uicv.setName((String) newValue);
uicv.hasChanged = true;
viewer.refresh();
markMainAsDirty(uus);
notifyDataseObjectPropertyChanged(uicv, "name", oldValue, newValue, new HashSet<Object>());
break;
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Unable to refactor the references of '" + newValue + "' variable for UseShared !");
}
}
}
}
}
}
}
}
} else // Case a RequestableVariable has been renamed
if (databaseObject instanceof RequestableVariable) {
RequestableVariable variable = (RequestableVariable) databaseObject;
DatabaseObject parent = variable.getParent();
if (getObject() instanceof UIDynamicAction) {
UIDynamicAction uia = (UIDynamicAction) getObject();
IonBean ionBean = uia.getIonBean();
if (ionBean != null) {
// rename variable for CallSequenceAction
if (ionBean.getName().equals("CallSequenceAction")) {
Object p_val = ionBean.getProperty("requestable").getValue();
if (!p_val.equals(false)) {
if (parent.getQName().equals(p_val.toString())) {
boolean isLocalProject = variable.getProject().equals(uia.getProject());
boolean isSameValue = variable.getName().equals(oldValue);
boolean shouldUpdate = (update == TreeObjectEvent.UPDATE_ALL) || ((update == TreeObjectEvent.UPDATE_LOCAL) && (isLocalProject));
if (!isSameValue && shouldUpdate) {
Iterator<UIComponent> it = uia.getUIComponentList().iterator();
while (it.hasNext()) {
UIComponent component = (UIComponent) it.next();
if (component instanceof UIControlVariable) {
UIControlVariable uicv = (UIControlVariable) component;
if (uicv.getName().equals(oldValue)) {
try {
uicv.setName((String) newValue);
uicv.hasChanged = true;
viewer.refresh();
markMainAsDirty(uia);
notifyDataseObjectPropertyChanged(uicv, "name", oldValue, newValue, new HashSet<Object>());
break;
} catch (EngineException e) {
ConvertigoPlugin.logException(e, "Unable to refactor the references of '" + newValue + "' variable for CallSequenceAction !");
}
}
}
}
}
}
}
}
}
}
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.UIDynamicInvoke in project convertigo by convertigo.
the class NgxUIComponentTreeObject method handleSharedActionChanged.
protected void handleSharedActionChanged(UIActionStack sharedAction, Set<Object> done) {
if (sharedAction != null) {
// a uic has changed/added/removed from a shared action referenced by this UIDynamicInvoke
if (getObject() instanceof UIDynamicInvoke) {
UIDynamicInvoke udi = (UIDynamicInvoke) getObject();
if (udi.getSharedActionQName().equals(sharedAction.getQName())) {
UIActionStack uisa = udi.getSharedAction();
UISharedComponent uisc = udi.getSharedComponent();
// udi inside a shared action
if (uisa != null && !uisa.equals(sharedAction)) {
notifyDataseObjectPropertyChanged(uisa, "", null, null, done);
} else // udi inside a shared component
if (uisc != null) {
notifyDataseObjectPropertyChanged(uisc, "", null, null, done);
} else // udi inside a page or menu
{
try {
markMainAsDirty(udi, done);
} catch (EngineException e) {
e.printStackTrace();
}
}
}
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.UIDynamicInvoke in project convertigo by convertigo.
the class NgxUIComponentTreeObject method getNamedSourceSelector.
@Override
public NamedSourceSelector getNamedSourceSelector() {
return new NamedSourceSelector() {
@Override
Object thisTreeObject() {
return NgxUIComponentTreeObject.this;
}
@Override
protected List<String> getPropertyNamesForSource(Class<?> c) {
List<String> list = new ArrayList<String>();
UIComponent object = getObject();
if (object instanceof UIDynamicTabButton) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || NgxApplicationComponentTreeObject.class.isAssignableFrom(c) || NgxPageComponentTreeObject.class.isAssignableFrom(c)) {
list.add("tabpage");
}
} else if (object instanceof UIDynamicMenuItem) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || NgxApplicationComponentTreeObject.class.isAssignableFrom(c) || NgxPageComponentTreeObject.class.isAssignableFrom(c)) {
list.add("itempage");
}
} else if (object instanceof UIDynamicAnimate) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || NgxApplicationComponentTreeObject.class.isAssignableFrom(c) || NgxPageComponentTreeObject.class.isAssignableFrom(c) || NgxUIComponentTreeObject.class.isAssignableFrom(c)) {
list.add("identifiable");
}
} else if (object instanceof UIDynamicInvoke) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || NgxApplicationComponentTreeObject.class.isAssignableFrom(c) || NgxUIComponentTreeObject.class.isAssignableFrom(c)) {
list.add("stack");
}
} else if (object instanceof UIUseShared) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || NgxApplicationComponentTreeObject.class.isAssignableFrom(c) || NgxUIComponentTreeObject.class.isAssignableFrom(c)) {
list.add("sharedcomponent");
}
} else if (object instanceof UIDynamicInfiniteScroll) {
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || NgxApplicationComponentTreeObject.class.isAssignableFrom(c) || NgxPageComponentTreeObject.class.isAssignableFrom(c) || NgxUIComponentTreeObject.class.isAssignableFrom(c)) {
list.add("scrollaction");
}
} else if (object instanceof UIDynamicElement) {
if (ProjectTreeObject.class.isAssignableFrom(c) || SequenceTreeObject.class.isAssignableFrom(c) || ConnectorTreeObject.class.isAssignableFrom(c)) {
list.add("requestable");
}
if (ProjectTreeObject.class.isAssignableFrom(c) || MobileApplicationTreeObject.class.isAssignableFrom(c) || NgxApplicationComponentTreeObject.class.isAssignableFrom(c) || NgxPageComponentTreeObject.class.isAssignableFrom(c)) {
list.add("page");
}
if (ProjectTreeObject.class.isAssignableFrom(c) || ConnectorTreeObject.class.isAssignableFrom(c) || DesignDocumentTreeObject.class.isAssignableFrom(c) || DesignDocumentViewTreeObject.class.isAssignableFrom(c)) {
list.add("fsview");
}
}
return list;
}
@Override
protected boolean isNamedSource(String propertyName) {
UIComponent object = getObject();
if (object instanceof UIDynamicTab) {
return "tabpage".equals(propertyName);
} else if (object instanceof UIDynamicMenuItem) {
return "itempage".equals(propertyName);
} else if (object instanceof UIDynamicAnimate) {
return "identifiable".equals(propertyName);
} else if (object instanceof UIDynamicInvoke) {
return "stack".equals(propertyName);
} else if (object instanceof UIUseShared) {
return "sharedcomponent".equals(propertyName);
} else if (object instanceof UIDynamicInfiniteScroll) {
return "scrollaction".equals(propertyName);
} else if (object instanceof UIDynamicElement) {
return "requestable".equals(propertyName) || "fsview".equals(propertyName) || "page".equals(propertyName);
}
return false;
}
@Override
public boolean isSelectable(String propertyName, Object nsObject) {
UIComponent object = getObject();
if (object instanceof UIDynamicTabButton) {
if ("tabpage".equals(propertyName)) {
if (nsObject instanceof PageComponent) {
return (((PageComponent) nsObject).getProject().equals(object.getProject()));
}
}
} else if (object instanceof UIDynamicMenuItem) {
if ("itempage".equals(propertyName)) {
if (nsObject instanceof PageComponent) {
return (((PageComponent) nsObject).getProject().equals(object.getProject()));
}
}
} else if (object instanceof UIDynamicAnimate) {
if ("identifiable".equals(propertyName)) {
UIDynamicAnimate uda = (UIDynamicAnimate) object;
if (nsObject instanceof UIElement) {
UIElement ue = (UIElement) nsObject;
if (hasSameScriptComponent(uda, ue)) {
return !ue.getIdentifier().isEmpty();
}
}
}
} else if (object instanceof UIDynamicInvoke) {
if ("stack".equals(propertyName)) {
return nsObject instanceof UIActionStack;
}
} else if (object instanceof UIUseShared) {
if ("sharedcomponent".equals(propertyName)) {
return nsObject instanceof UISharedComponent;
}
} else if (object instanceof UIDynamicInfiniteScroll) {
if ("scrollaction".equals(propertyName)) {
if (nsObject instanceof UIDynamicAction) {
UIDynamicAction uida = (UIDynamicAction) nsObject;
if (uida.getProject().equals(object.getProject())) {
if (uida.getIonBean().getName().equals("CallSequenceAction")) {
return true;
}
if (uida.getIonBean().getName().equals("FullSyncViewAction")) {
return true;
}
}
}
}
} else if (object instanceof UIDynamicElement) {
if ("requestable".equals(propertyName)) {
UIDynamicElement cc = (UIDynamicElement) object;
if (cc.getIonBean().getName().equals("CallSequenceAction")) {
return nsObject instanceof Sequence;
}
if (cc.getIonBean().getName().equals("CallFullSyncAction")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("FullSyncSyncAction")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("FullSyncViewAction")) {
return nsObject instanceof DesignDocument;
}
if (cc.getIonBean().getName().equals("FullSyncPostAction")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("FullSyncGetAction")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("FullSyncDeleteAction")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("FullSyncPutAttachmentAction")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("FullSyncDeleteAttachmentAction")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("FSImage")) {
return nsObject instanceof FullSyncConnector;
}
if (cc.getIonBean().getName().equals("AutoScrollComponent")) {
return nsObject instanceof Sequence;
}
}
if ("fsview".equals(propertyName)) {
UIDynamicElement cc = (UIDynamicElement) object;
if (cc.getIonBean().getName().equals("FullSyncViewAction")) {
return nsObject instanceof String;
}
if (cc.getIonBean().getName().equals("AutoScrollComponent")) {
return nsObject instanceof DesignDocument || nsObject instanceof String;
}
}
if ("page".equals(propertyName)) {
if (nsObject instanceof PageComponent) {
return (((PageComponent) nsObject).getProject().equals(object.getProject()));
}
}
}
return false;
}
@Override
protected void handleSourceCleared(String propertyName) {
// nothing to do
}
@Override
protected void handleSourceRenamed(String propertyName, String oldName, String newName) {
if (isNamedSource(propertyName)) {
boolean hasBeenRenamed = false;
Object oValue = getPropertyValue(propertyName);
String pValue;
if (oValue instanceof MobileSmartSourceType) {
MobileSmartSourceType sst = (MobileSmartSourceType) oValue;
pValue = sst.getSmartValue();
} else {
pValue = (String) oValue;
}
String _pValue = pValue;
if (pValue != null && (pValue.startsWith(oldName + ".") || pValue.equals(oldName))) {
_pValue = newName + pValue.substring(oldName.length());
if (!pValue.equals(_pValue)) {
UIComponent object = getObject();
if (object instanceof UIDynamicTab) {
if ("tabpage".equals(propertyName)) {
((UIDynamicTab) object).setTabPage(_pValue);
hasBeenRenamed = true;
}
} else if (object instanceof UIDynamicMenuItem) {
if ("itempage".equals(propertyName)) {
((UIDynamicMenuItem) object).setItemPage(_pValue);
hasBeenRenamed = true;
}
} else if (object instanceof UIDynamicAnimate) {
if ("identifiable".equals(propertyName)) {
((UIDynamicAnimate) object).setIdentifiable(_pValue);
hasBeenRenamed = true;
}
} else if (object instanceof UIDynamicInvoke) {
if ("stack".equals(propertyName)) {
((UIDynamicInvoke) object).setSharedActionQName(_pValue);
hasBeenRenamed = true;
}
} else if (object instanceof UIUseShared) {
if ("sharedcomponent".equals(propertyName)) {
((UIUseShared) object).setSharedComponentQName(_pValue);
hasBeenRenamed = true;
}
} else if (object instanceof UIDynamicInfiniteScroll) {
if ("scrollaction".equals(propertyName)) {
((UIDynamicInfiniteScroll) object).setScrollAction(_pValue);
hasBeenRenamed = true;
}
} else if (object instanceof UIDynamicElement) {
if ("requestable".equals(propertyName)) {
((UIDynamicElement) object).getIonBean().setPropertyValue("requestable", new MobileSmartSourceType(_pValue));
hasBeenRenamed = true;
}
if ("fsview".equals(propertyName)) {
((UIDynamicElement) object).getIonBean().setPropertyValue("fsview", new MobileSmartSourceType(_pValue));
hasBeenRenamed = true;
}
if ("page".equals(propertyName)) {
((UIDynamicElement) object).getIonBean().setPropertyValue("page", new MobileSmartSourceType(_pValue));
hasBeenRenamed = true;
}
} else if (object instanceof UIText) {
if ("textValue".equals(propertyName)) {
((UIText) object).setTextSmartType(new MobileSmartSourceType(_pValue));
hasBeenRenamed = true;
}
}
}
}
if (hasBeenRenamed) {
hasBeenModified(true);
viewer.refresh();
ConvertigoPlugin.projectManager.getProjectExplorerView().updateTreeObject(NgxUIComponentTreeObject.this);
// refresh editors (e.g labels in combobox)
getDescriptors();
TreeObjectEvent treeObjectEvent = new TreeObjectEvent(NgxUIComponentTreeObject.this, propertyName, pValue, _pValue);
ConvertigoPlugin.projectManager.getProjectExplorerView().fireTreeObjectPropertyChanged(treeObjectEvent);
}
}
}
@Override
protected void refactorSmartSources(Class<?> c, String oldName, String newName) {
try {
// A project has been renamed
if (ProjectTreeObject.class.isAssignableFrom(c)) {
UIComponent object = getObject();
for (java.beans.PropertyDescriptor pd : CachedIntrospector.getBeanInfo(object).getPropertyDescriptors()) {
if (pd.getPropertyType().equals(MobileSmartSourceType.class)) {
String propertyName = pd.getName();
Object oValue = getPropertyValue(propertyName);
MobileSmartSourceType msst = (MobileSmartSourceType) oValue;
MobileSmartSource mss = msst.getSmartSource();
boolean hasBeenChanged = false;
if (mss != null) {
if (oldName.equals(mss.getProjectName())) {
mss.setProjectName(newName);
msst.setSmartValue(mss.toJsonString());
hasBeenChanged = true;
}
}
if (hasBeenChanged) {
Object nValue = getPropertyValue(propertyName);
hasBeenModified(true);
viewer.refresh();
ConvertigoPlugin.projectManager.getProjectExplorerView().updateTreeObject(NgxUIComponentTreeObject.this);
// refresh editors (e.g labels in combobox)
getDescriptors();
TreeObjectEvent treeObjectEvent = new TreeObjectEvent(NgxUIComponentTreeObject.this, propertyName, oValue, nValue);
ConvertigoPlugin.projectManager.getProjectExplorerView().fireTreeObjectPropertyChanged(treeObjectEvent);
}
}
}
}
} catch (Exception e) {
// TODO: handle exception
}
}
};
}
use of com.twinsoft.convertigo.beans.ngx.components.UIDynamicInvoke in project convertigo by convertigo.
the class ApplicationComponentEditor method highlightPoint.
private void highlightPoint(int x, int y) {
Node node = browser.mainFrame().get().inspect(x, y).node().get();
while (!(node == null || node instanceof Element)) {
node = node.parent().orElse(null);
}
Object shadowHost = c8oBrowser.executeFunctionAndReturnValue("_c8o_getShadowHost", node);
if (shadowHost != null && shadowHost instanceof Element) {
node = (Element) shadowHost;
}
while (node != null) {
Element element = (Element) node;
if (element.equals(exHighlightElement)) {
return;
}
exHighlightElement = element;
String classes = element.attributeValue("class");
Matcher mPriority = pPriority.matcher(classes);
if (mPriority.find()) {
try {
node = null;
long priority = Long.parseLong(mPriority.group(1));
new WalkHelper() {
@Override
protected void walk(DatabaseObject databaseObject) throws Exception {
if (databaseObject instanceof UIUseShared) {
UISharedComponent uisc = ((UIUseShared) databaseObject).getTargetSharedComponent();
if (uisc != null) {
databaseObject = uisc;
}
} else if (databaseObject instanceof UIDynamicInvoke) {
UIDynamicInvoke uidi = (UIDynamicInvoke) databaseObject;
UIActionStack uisa = uidi.getTargetSharedAction();
if (uisa != null) {
if (!uidi.isRecursive()) {
databaseObject = uisa;
}
}
}
if (databaseObject.priority == priority) {
throw new DatabaseObjectFoundException(databaseObject);
}
super.walk(databaseObject);
}
}.init(applicationEditorInput.application);
} catch (DatabaseObjectFoundException e) {
DatabaseObject databaseObject = e.getDatabaseObject();
c8oBrowser.getDisplay().asyncExec(() -> ConvertigoPlugin.getDefault().getProjectExplorerView().objectSelected(new CompositeEvent(databaseObject)));
if (databaseObject instanceof MobileComponent && !databaseObject.equals(exHighlightMobileComponent)) {
highlightComponent(exHighlightMobileComponent = (MobileComponent) databaseObject, false);
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
node = node.parent().orElse(null);
while (!(node == null || node instanceof Element)) {
node = node.parent().orElse(null);
}
}
}
}
use of com.twinsoft.convertigo.beans.ngx.components.UIDynamicInvoke in project convertigo by convertigo.
the class NgxComponentImportVariablesAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
Object databaseObject = treeObject.getObject();
if (databaseObject != null) {
if (databaseObject instanceof UIDynamicAction) {
UIDynamicAction dynAction = (UIDynamicAction) databaseObject;
IonBean ionBean = ((UIDynamicAction) dynAction).getIonBean();
if (ionBean != null) {
// Case of CallSequenceAction
if (ionBean.getName().equals("CallSequenceAction")) {
Object value = ionBean.getProperty("requestable").getValue();
if (!value.equals(false)) {
String target = value.toString();
if (!target.isEmpty()) {
try {
String projectName = target.substring(0, target.indexOf('.'));
String sequenceName = target.substring(target.indexOf('.') + 1);
Project p = Engine.theApp.databaseObjectsManager.getProjectByName(projectName);
Sequence sequence = p.getSequenceByName(sequenceName);
int size = sequence.numberOfVariables();
for (int i = 0; i < size; i++) {
RequestableVariable variable = (RequestableVariable) sequence.getVariable(i);
if (variable != null) {
String variableName = variable.getName();
if (dynAction.getVariable(variableName) == null) {
if (!StringUtils.isNormalized(variableName))
throw new EngineException("Variable name is not normalized : \"" + variableName + "\".");
UIControlVariable uiVariable = new UIControlVariable();
uiVariable.setName(variableName);
uiVariable.setComment(variable.getDescription());
uiVariable.setVarSmartType(new MobileSmartSourceType(variable.getDefaultValue().toString()));
dynAction.addUIComponent(uiVariable);
uiVariable.bNew = true;
uiVariable.hasChanged = true;
dynAction.hasChanged = true;
}
}
}
} catch (Exception e) {
}
}
}
} else // Case of InvokeAction
if (ionBean.getName().equals("InvokeAction")) {
UIDynamicInvoke dynInvoke = (UIDynamicInvoke) databaseObject;
UIActionStack stack = dynInvoke.getTargetSharedAction();
if (stack != null) {
for (UIStackVariable variable : stack.getVariables()) {
String variableName = variable.getName();
if (dynAction.getVariable(variableName) == null) {
if (!StringUtils.isNormalized(variableName))
throw new EngineException("Variable name is not normalized : \"" + variableName + "\".");
UIControlVariable uiVariable = new UIControlVariable();
uiVariable.setName(variableName);
uiVariable.setComment(variable.getComment());
MobileSmartSourceType msst = new MobileSmartSourceType();
msst.setMode(MobileSmartSourceType.Mode.SCRIPT);
msst.setSmartValue(variable.getVariableValue());
uiVariable.setVarSmartType(msst);
dynAction.addUIComponent(uiVariable);
uiVariable.bNew = true;
uiVariable.hasChanged = true;
dynAction.hasChanged = true;
}
}
}
}
if (dynAction.hasChanged) {
IScriptComponent main = dynAction.getMainScriptComponent();
if (main != null) {
if (main instanceof ApplicationComponent) {
((ApplicationComponent) main).markApplicationAsDirty();
}
if (main instanceof PageComponent) {
((PageComponent) main).markPageAsDirty();
}
}
explorerView.reloadTreeObject(treeObject);
StructuredSelection structuredSelection = new StructuredSelection(treeObject);
ConvertigoPlugin.getDefault().getPropertiesView().selectionChanged((IWorkbenchPart) explorerView, structuredSelection);
}
}
} else if (databaseObject instanceof UIUseShared) {
UIUseShared useShared = (UIUseShared) databaseObject;
UISharedComponent sharedComp = useShared.getTargetSharedComponent();
if (sharedComp != null) {
for (UICompVariable variable : sharedComp.getVariables()) {
String variableName = variable.getName();
if (useShared.getVariable(variableName) == null) {
if (!StringUtils.isNormalized(variableName))
throw new EngineException("Variable name is not normalized : \"" + variableName + "\".");
UIControlVariable uiVariable = new UIControlVariable();
uiVariable.setName(variableName);
uiVariable.setComment(variable.getComment());
MobileSmartSourceType msst = new MobileSmartSourceType();
msst.setMode(MobileSmartSourceType.Mode.SCRIPT);
msst.setSmartValue(variable.getVariableValue());
uiVariable.setVarSmartType(msst);
useShared.addUIComponent(uiVariable);
uiVariable.bNew = true;
uiVariable.hasChanged = true;
useShared.hasChanged = true;
}
}
if (useShared.hasChanged) {
IScriptComponent main = useShared.getMainScriptComponent();
if (main != null) {
if (main instanceof ApplicationComponent) {
((ApplicationComponent) main).markApplicationAsDirty();
}
if (main instanceof PageComponent) {
((PageComponent) main).markPageAsDirty();
}
}
explorerView.reloadTreeObject(treeObject);
StructuredSelection structuredSelection = new StructuredSelection(treeObject);
ConvertigoPlugin.getDefault().getPropertiesView().selectionChanged((IWorkbenchPart) explorerView, structuredSelection);
}
}
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to add variables to action !");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations