*
*/
-
package org.tizen.webuibuilder.ui.views.pages;
import org.eclipse.draw2d.ColorConstants;
import org.tizen.webuibuilder.model.page.PageDataSet;
import org.tizen.webuibuilder.model.page.PageDataSetEvent;
-
-public class PagesPage extends Page implements IAppListener, IPageDataSetListener {
-
- private AppManager appManager;
- // controls
- private EditDomain editDomain;
- private ImageViewer viewer;
- // selections
- private SelectionSynchronizer selectionSyncronizer;
- // actions
- private ActionRegistry actionRegistry;
-
- public PagesPage(SelectionSynchronizer selectionSyncronizer, EditDomain editDomain,
- ActionRegistry actionRegistry) {
- this.viewer = new ImageViewer();
- this.selectionSyncronizer = selectionSyncronizer;
- this.editDomain = editDomain;
- this.actionRegistry = actionRegistry;
- }
-
- public void setAppManager(AppManager appManager) {
- this.appManager = appManager;
- }
-
- public AppManager getAppManager() {
- return appManager;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(Composite parent) {
- configureToolBar();
- viewer.createControl(parent);
- viewer.setEditDomain(editDomain);
- viewer.setEditPartFactory(new ThumbnailEditPartFactory());
- viewer.getControl().setBackground(ColorConstants.listBackground);
- viewer.setContextMenu(new PagesViewContextMenu(viewer, actionRegistry));
- getSite().setSelectionProvider(viewer);
- selectionSyncronizer.addViewer(viewer);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.Page#dispose()
- */
- @Override
- public void dispose() {
- selectionSyncronizer.removeViewer(viewer);
- removeListeners();
- super.dispose();
- }
-
- private void configureToolBar() {
- // IActionBars actionBars = getSite().getActionBars();
- // IToolBarManager toolBarManager = actionBars.getToolBarManager();
- // IAction action = null;
- // action = actionRegistry.getAction(ActionFactory.UNDO.getId());
- // toolBarManager.add(action);
- // action = actionRegistry.getAction(ActionFactory.REDO.getId());
- // toolBarManager.add(action);
- // actionBars.updateActionBars();
- }
-
- private void addListeners() {
- getAppManager().addPageListener(this);
- }
-
- private void removeListeners() {
- getAppManager().removePageListener(this);
- }
-
- public void setInput(AppManager appManager) {
- if (appManager == null) {
- return;
- }
- ((ThumbnailEditPartFactory) viewer.getEditPartFactory()).setAppManager(appManager);
- PageDataSet pageDataSet = appManager.getPageDataSet();
- if (pageDataSet != null) {
- viewer.setContents(pageDataSet.getBaseRootPart());
- pageDataSet.addPageListener(this);
- }
- setAppManager(appManager);
- addListeners();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.Page#getControl()
- */
- @Override
- public Control getControl() {
- return viewer.getControl();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.part.Page#setFocus()
- */
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.tizen.webuibuilder.model.project.IProjectListener#pageAdded(org.tizen
- * .webuibuilder.model.project.ProjectEvent)
- */
- @Override
- public void pageAdded(PageDataSetEvent e) {
- Object model = appManager.getPageDataSet().getBaseRootPart();
- viewer.setContents(model);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.tizen.webuibuilder.model.project.IProjectListener#pageRemoved(org
- * .tizen.webuibuilder.model.project.ProjectEvent)
- */
- @Override
- public void pageRemoved(PageDataSetEvent e) {
- Object model = appManager.getPageDataSet().getBaseRootPart();
- viewer.setContents(model);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.tizen.webuibuilder.model.project.IProjectListener#pageRenamed(org
- * .tizen.webuibuilder.model.project.ProjectEvent)
- */
- @Override
- public void pageRenamed(PageDataSetEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.tizen.webuibuilder.model.project.IProjectListener#pageMoved(org.tizen
- * .webuibuilder.model.project.ProjectEvent)
- */
- @Override
- public void pageMoved(PageDataSetEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.tizen.webuibuilder.model.project.IProjectListener#pageStartupChanged
- * (org.tizen.webuibuilder.model.project.ProjectEvent)
- */
- @Override
- public void pageStartupChanged(AppEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.tizen.webuibuilder.model.project.IProjectListener#pageLayoutChanged
- * (org.tizen.webuibuilder.model.project.ProjectEvent)
- */
- @Override
- public void pageLayoutChanged(AppEvent e) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.tizen.webuibuilder.model.page.IPageDataSetListener#allPagesReseted(org.tizen.webuibuilder
- * .model.page.PageDataSetEvent)
- */
- @Override
- public void allPagesReseted(PageDataSetEvent e) {
- Object model = appManager.getPageDataSet().getBaseRootPart();
- viewer.setContents(model);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.tizen.webuibuilder.model.page.IPageDataSetListener#pagePreDelete(org.tizen.webuibuilder
- * .model.page.PageDataSetEvent)
- */
- @Override
- public void pagePreDelete(PageDataSetEvent e) {
- }
-
+public class PagesPage extends Page implements IAppListener,
+ IPageDataSetListener {
+
+ private AppManager appManager;
+ // controls
+ private EditDomain editDomain;
+ private ImageViewer viewer;
+ // selections
+ private SelectionSynchronizer selectionSyncronizer;
+ // actions
+ private ActionRegistry actionRegistry;
+
+ public PagesPage(SelectionSynchronizer selectionSyncronizer,
+ EditDomain editDomain, ActionRegistry actionRegistry) {
+ this.viewer = new ImageViewer();
+ this.selectionSyncronizer = selectionSyncronizer;
+ this.editDomain = editDomain;
+ this.actionRegistry = actionRegistry;
+ }
+
+ public void setAppManager(AppManager appManager) {
+ this.appManager = appManager;
+ }
+
+ public AppManager getAppManager() {
+ return appManager;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ configureToolBar();
+ viewer.createControl(parent);
+ viewer.setEditDomain(editDomain);
+ viewer.setEditPartFactory(new ThumbnailEditPartFactory());
+ viewer.getControl().setBackground(ColorConstants.listBackground);
+ viewer.setContextMenu(new PagesViewContextMenu(viewer, actionRegistry));
+ getSite().setSelectionProvider(viewer);
+ selectionSyncronizer.addViewer(viewer);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.Page#dispose()
+ */
+ @Override
+ public void dispose() {
+ selectionSyncronizer.removeViewer(viewer);
+ removeListeners();
+ super.dispose();
+ }
+
+ private void configureToolBar() {
+ // IActionBars actionBars = getSite().getActionBars();
+ // IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ // IAction action = null;
+ // action = actionRegistry.getAction(ActionFactory.UNDO.getId());
+ // toolBarManager.add(action);
+ // action = actionRegistry.getAction(ActionFactory.REDO.getId());
+ // toolBarManager.add(action);
+ // actionBars.updateActionBars();
+ }
+
+ private void addListeners() {
+ getAppManager().addPageListener(this);
+ }
+
+ private void removeListeners() {
+ getAppManager().removePageListener(this);
+ }
+
+ public void setInput(AppManager appManager) {
+ if (appManager == null) {
+ return;
+ }
+ ((ThumbnailEditPartFactory) viewer.getEditPartFactory())
+ .setAppManager(appManager);
+ PageDataSet pageDataSet = appManager.getPageDataSet();
+ if (pageDataSet != null) {
+ viewer.setContents(pageDataSet.getBaseRootPart());
+ pageDataSet.addPageListener(this);
+ }
+ setAppManager(appManager);
+ addListeners();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.Page#getControl()
+ */
+ @Override
+ public Control getControl() {
+ return viewer.getControl();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.part.Page#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.project.IProjectListener#pageAdded(org.tizen
+ * .webuibuilder.model.project.ProjectEvent)
+ */
+ @Override
+ public void pageAdded(PageDataSetEvent e) {
+ Object model = appManager.getPageDataSet().getBaseRootPart();
+ viewer.setContents(model);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.project.IProjectListener#pageRemoved(org
+ * .tizen.webuibuilder.model.project.ProjectEvent)
+ */
+ @Override
+ public void pageRemoved(PageDataSetEvent e) {
+ Object model = appManager.getPageDataSet().getBaseRootPart();
+ viewer.setContents(model);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.project.IProjectListener#pageRenamed(org
+ * .tizen.webuibuilder.model.project.ProjectEvent)
+ */
+ @Override
+ public void pageRenamed(PageDataSetEvent e) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.project.IProjectListener#pageMoved(org.tizen
+ * .webuibuilder.model.project.ProjectEvent)
+ */
+ @Override
+ public void pageMoved(PageDataSetEvent e) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.project.IProjectListener#pageStartupChanged
+ * (org.tizen.webuibuilder.model.project.ProjectEvent)
+ */
+ @Override
+ public void pageStartupChanged(AppEvent e) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.project.IProjectListener#pageLayoutChanged
+ * (org.tizen.webuibuilder.model.project.ProjectEvent)
+ */
+ @Override
+ public void pageLayoutChanged(AppEvent e) {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.page.IPageDataSetListener#allPagesReseted
+ * (org.tizen.webuibuilder .model.page.PageDataSetEvent)
+ */
+ @Override
+ public void allPagesReseted(PageDataSetEvent e) {
+ Object model = appManager.getPageDataSet().getBaseRootPart();
+ viewer.setContents(model);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.tizen.webuibuilder.model.page.IPageDataSetListener#pagePreDelete(
+ * org.tizen.webuibuilder .model.page.PageDataSetEvent)
+ */
+ @Override
+ public void pagePreDelete(PageDataSetEvent e) {
+ }
}