Search in sources :

Example 1 with RouteEventComponent

use of com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent in project convertigo by convertigo.

the class EnableMobileRouteEventComponentAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapObject[] treeObjects = studio.getSelectedObjects().toArray(new WrapObject[0]);
        for (int i = treeObjects.length - 1; i >= 0; --i) {
            WrapDatabaseObject treeObject = (WrapDatabaseObject) treeObjects[i];
            if (treeObject.instanceOf(RouteEventComponent.class)) {
                // StepView stepTreeObject = (StepView) treeObject;
                RouteEventComponent component = (RouteEventComponent) treeObject.getObject();
                component.setEnabled(true);
            // stepTreeObject.setEnabled(true);
            // stepTreeObject.hasBeenModified(true);
            // TreeObjectEvent treeObjectEvent = new TreeObjectEvent(stepTreeObject, "isEnable", false, true);
            // explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
            }
        }
    // explorerView.refreshSelectedTreeObjects();
    } catch (Throwable e) {
        throw e;
    // ConvertigoPlugin.logException(e, "Unable to enable step!");
    }
// finally {
// shell.setCursor(null);
// waitCursor.dispose();
}
Also used : WrapObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapObject) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) RouteEventComponent(com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent)

Example 2 with RouteEventComponent

use of com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent in project convertigo by convertigo.

the class DisableMobileRouteEventComponentAction method run2.

@Override
protected void run2() throws Exception {
    try {
        WrapObject[] treeObjects = studio.getSelectedObjects().toArray(new WrapObject[0]);
        for (int i = treeObjects.length - 1; i >= 0; --i) {
            WrapDatabaseObject treeObject = (WrapDatabaseObject) treeObjects[i];
            if (treeObject.instanceOf(RouteEventComponent.class)) {
                // StepView stepTreeObject = (StepView) treeObject;
                RouteEventComponent component = (RouteEventComponent) treeObject.getObject();
                component.setEnabled(false);
            // stepTreeObject.setEnabled(true);
            // stepTreeObject.hasBeenModified(true);
            // TreeObjectEvent treeObjectEvent = new TreeObjectEvent(stepTreeObject, "isEnable", false, true);
            // explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
            }
        }
    // explorerView.refreshSelectedTreeObjects();
    } catch (Throwable e) {
        throw e;
    // ConvertigoPlugin.logException(e, "Unable to enable step!");
    }
// finally {
// shell.setCursor(null);
// waitCursor.dispose();
}
Also used : WrapObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapObject) WrapDatabaseObject(com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject) RouteEventComponent(com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent)

Example 3 with RouteEventComponent

use of com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent in project convertigo by convertigo.

the class EnableMobileRouteEventComponentAction 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) {
            DatabaseObjectTreeObject treeObject = null;
            RouteEventComponent component = null;
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            for (int i = treeObjects.length - 1; i >= 0; i--) {
                treeObject = (DatabaseObjectTreeObject) treeObjects[i];
                if (treeObject instanceof MobileRouteEventComponentTreeObject) {
                    MobileRouteEventComponentTreeObject componentTreeObject = (MobileRouteEventComponentTreeObject) treeObject;
                    component = (RouteEventComponent) componentTreeObject.getObject();
                    component.setEnabled(true);
                    componentTreeObject.setEnabled(true);
                    componentTreeObject.hasBeenModified(true);
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", false, true);
                    explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
            explorerView.refreshSelectedTreeObjects();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to enable event!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Cursor(org.eclipse.swt.graphics.Cursor) RouteEventComponent(com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent) Display(org.eclipse.swt.widgets.Display)

Example 4 with RouteEventComponent

use of com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent in project convertigo by convertigo.

the class DisableMobileRouteEventComponentAction 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) {
            DatabaseObjectTreeObject treeObject = null;
            RouteEventComponent component = null;
            TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
            for (int i = treeObjects.length - 1; i >= 0; i--) {
                treeObject = (DatabaseObjectTreeObject) treeObjects[i];
                if (treeObject instanceof MobileRouteEventComponentTreeObject) {
                    MobileRouteEventComponentTreeObject componentTreeObject = (MobileRouteEventComponentTreeObject) treeObject;
                    component = (RouteEventComponent) componentTreeObject.getObject();
                    component.setEnabled(false);
                    componentTreeObject.setEnabled(false);
                    componentTreeObject.hasBeenModified(true);
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(componentTreeObject, "isEnabled", true, false);
                    explorerView.fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
            explorerView.refreshSelectedTreeObjects();
        }
    } catch (Throwable e) {
        ConvertigoPlugin.logException(e, "Unable to disable event!");
    } finally {
        shell.setCursor(null);
        waitCursor.dispose();
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ProjectExplorerView(com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) TreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject) DatabaseObjectTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject) MobileRouteEventComponentTreeObject(com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) Cursor(org.eclipse.swt.graphics.Cursor) RouteEventComponent(com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent) Display(org.eclipse.swt.widgets.Display)

Example 5 with RouteEventComponent

use of com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent in project convertigo by convertigo.

the class MobileRouteEventComponentTreeObject method getNamedSourceSelector.

@Override
public NamedSourceSelector getNamedSourceSelector() {
    return new NamedSourceSelector() {

        @Override
        Object thisTreeObject() {
            return MobileRouteEventComponentTreeObject.this;
        }

        @Override
        protected List<String> getPropertyNamesForSource(Class<?> c) {
            List<String> list = new ArrayList<String>();
            if (getObject() instanceof RouteEventComponent) {
                if (ProjectTreeObject.class.isAssignableFrom(c) || SequenceTreeObject.class.isAssignableFrom(c) || ConnectorTreeObject.class.isAssignableFrom(c)) {
                    list.add("source");
                }
            }
            return list;
        }

        @Override
        protected boolean isNamedSource(String propertyName) {
            if (getObject() instanceof RouteEventComponent) {
                return "source".equals(propertyName);
            }
            return false;
        }

        @Override
        public boolean isSelectable(String propertyName, Object nsObject) {
            if (getObject() instanceof RouteEventComponent) {
                if ("source".equals(propertyName)) {
                    RouteEventComponent rec = getObject();
                    if (rec instanceof RouteSequenceEvent) {
                        return nsObject instanceof Sequence;
                    }
                    if (rec instanceof RouteFullsyncEvent) {
                        return nsObject instanceof FullSyncConnector;
                    }
                }
            }
            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;
                String pValue = (String) getPropertyValue(propertyName);
                if (pValue != null && pValue.startsWith(oldName)) {
                    String _pValue = newName + pValue.substring(oldName.length());
                    if (!pValue.equals(_pValue)) {
                        if (getObject() instanceof RouteEventComponent) {
                            if ("source".equals(propertyName)) {
                                ((RouteEventComponent) getObject()).setSource(_pValue);
                                hasBeenRenamed = true;
                            }
                        }
                    }
                }
                if (hasBeenRenamed) {
                    hasBeenModified(true);
                    ConvertigoPlugin.projectManager.getProjectExplorerView().updateTreeObject(MobileRouteEventComponentTreeObject.this);
                    // refresh editors (e.g labels in combobox)
                    getDescriptors();
                    TreeObjectEvent treeObjectEvent = new TreeObjectEvent(MobileRouteEventComponentTreeObject.this, propertyName, "", "");
                    ConvertigoPlugin.projectManager.getProjectExplorerView().fireTreeObjectPropertyChanged(treeObjectEvent);
                }
            }
        }
    };
}
Also used : RouteSequenceEvent(com.twinsoft.convertigo.beans.mobile.components.RouteSequenceEvent) RouteFullsyncEvent(com.twinsoft.convertigo.beans.mobile.components.RouteFullsyncEvent) ArrayList(java.util.ArrayList) Sequence(com.twinsoft.convertigo.beans.core.Sequence) FullSyncConnector(com.twinsoft.convertigo.beans.connectors.FullSyncConnector) TreeObjectEvent(com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent) RouteEventComponent(com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent)

Aggregations

RouteEventComponent (com.twinsoft.convertigo.beans.mobile.components.RouteEventComponent)5 TreeObjectEvent (com.twinsoft.convertigo.eclipse.views.projectexplorer.TreeObjectEvent)3 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)2 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)2 MobileRouteEventComponentTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.MobileRouteEventComponentTreeObject)2 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)2 WrapDatabaseObject (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapDatabaseObject)2 WrapObject (com.twinsoft.convertigo.engine.studio.views.projectexplorer.model.WrapObject)2 Cursor (org.eclipse.swt.graphics.Cursor)2 Display (org.eclipse.swt.widgets.Display)2 Shell (org.eclipse.swt.widgets.Shell)2 FullSyncConnector (com.twinsoft.convertigo.beans.connectors.FullSyncConnector)1 Sequence (com.twinsoft.convertigo.beans.core.Sequence)1 RouteFullsyncEvent (com.twinsoft.convertigo.beans.mobile.components.RouteFullsyncEvent)1 RouteSequenceEvent (com.twinsoft.convertigo.beans.mobile.components.RouteSequenceEvent)1 ArrayList (java.util.ArrayList)1