use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject in project convertigo by convertigo.
the class SetNgxRootPageAction 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) {
NgxPageComponentTreeObject pageTreeObject = (NgxPageComponentTreeObject) explorerView.getFirstSelectedTreeObject();
PageComponent page = (PageComponent) pageTreeObject.getObject();
ApplicationComponent application = (ApplicationComponent) page.getParent();
NgxPageComponentTreeObject rootPageTreeObject = null;
PageComponent rootPage = application.getRootPage();
if (rootPage != null) {
rootPageTreeObject = (NgxPageComponentTreeObject) explorerView.findTreeObjectByUserObject(rootPage);
}
application.setRootPage(page);
application.markRootAsDirty();
if (rootPageTreeObject != null) {
rootPageTreeObject.isDefault = false;
rootPageTreeObject.hasBeenModified(true);
}
pageTreeObject.isDefault = true;
pageTreeObject.hasBeenModified(true);
// Updating the tree
explorerView.refreshTreeObject(pageTreeObject.getParentDatabaseObjectTreeObject());
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to set page to root one!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject in project convertigo by convertigo.
the class SetNgxRootPageAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof NgxPageComponentTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
action.setChecked(actionModel.isChecked);
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject in project convertigo by convertigo.
the class DisableNgxPageComponentAction method selectionChanged.
public void selectionChanged(IAction action, ISelection selection) {
super.selectionChanged(action, selection);
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
TreeObject treeObject = (TreeObject) structuredSelection.getFirstElement();
if (treeObject instanceof NgxPageComponentTreeObject) {
DatabaseObject dbo = (DatabaseObject) treeObject.getObject();
ActionModel actionModel = DatabaseObjectsAction.selectionChanged(getClass().getName(), dbo);
action.setEnabled(actionModel.isEnabled);
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject in project convertigo by convertigo.
the class DisableNgxPageComponentAction 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;
PageComponent component = null;
TreeObject[] treeObjects = explorerView.getSelectedTreeObjects();
for (int i = treeObjects.length - 1; i >= 0; i--) {
treeObject = (DatabaseObjectTreeObject) treeObjects[i];
if (treeObject instanceof NgxPageComponentTreeObject) {
NgxPageComponentTreeObject componentTreeObject = GenericUtils.cast(treeObject);
component = (PageComponent) 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 page!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.projectexplorer.model.NgxPageComponentTreeObject in project convertigo by convertigo.
the class EditNgxComponentClassAction 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();
if (treeObject instanceof NgxComponentTreeObject) {
if (treeObject instanceof NgxApplicationComponentTreeObject) {
NgxApplicationComponentTreeObject mpcto = GenericUtils.cast(treeObject);
mpcto.editAppComponentTsFile();
} else if (treeObject instanceof NgxPageComponentTreeObject) {
NgxPageComponentTreeObject mpcto = GenericUtils.cast(treeObject);
mpcto.editPageTsFile();
} else if (treeObject instanceof NgxUIComponentTreeObject) {
NgxUIComponentTreeObject mpcto = GenericUtils.cast(treeObject);
mpcto.editCompTsFile();
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to edit ngx component class!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
Aggregations