summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Wouters2014-04-04 10:12:57 (EDT)
committerLaurent Wouters2014-04-04 10:12:57 (EDT)
commite55fae74e5196895d0f75e498594191e5b5d24df (patch)
tree2198639cbc07142dd7b5e64fa19d5fa04550e845
parent533d626e28b57981a5714f87ef03d7a1a2ae2f8a (diff)
downloadorg.eclipse.papyrus-e55fae74e5196895d0f75e498594191e5b5d24df.zip
org.eclipse.papyrus-e55fae74e5196895d0f75e498594191e5b5d24df.tar.gz
org.eclipse.papyrus-e55fae74e5196895d0f75e498594191e5b5d24df.tar.bz2
[clean] Retiring org.eclipse.papyrus.sasheditor.uilast/org.eclipse.papyrus.sasheditor.ui
Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/META-INF/MANIFEST.MF13
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/contexts.xml12
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/icons/sample.gifbin983 -> 0 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/plugin.xml38
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/Activator.java64
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsView.java123
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewModel.java320
-rw-r--r--deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewPart.java141
11 files changed, 0 insertions, 753 deletions
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/.classpath b/deprecated/org.eclipse.papyrus.sasheditor.ui/.classpath
deleted file mode 100644
index 2d1a430..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/.project b/deprecated/org.eclipse.papyrus.sasheditor.ui/.project
deleted file mode 100644
index 128d28c..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.sasheditor.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.sasheditor.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 6750130..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,13 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Ui
-Bundle-SymbolicName: org.eclipse.papyrus.sasheditor.ui; singleton:=true
-Bundle-Version: 1.0.0
-Bundle-Activator: org.eclipse.papyrus.sasheditor.ui.Activator
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.papyrus.sasheditor;bundle-version="0.7.0",
- org.eclipse.ui.forms;bundle-version="3.4.0",
- org.eclipse.jface.text;bundle-version="3.5.0"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/build.properties b/deprecated/org.eclipse.papyrus.sasheditor.ui/build.properties
deleted file mode 100644
index 255e23b..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
- META-INF/,\
- .,\
- icons/,\
- contexts.xml
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/contexts.xml b/deprecated/org.eclipse.papyrus.sasheditor.ui/contexts.xml
deleted file mode 100644
index 64aff45..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/contexts.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<contexts>
- <context id="viewer" title="Sample View">
- <description>This is the context help for the sample view with a tree viewer. It was generated by a PDE template.</description>
- <topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help">
- <enablement>
- <with variable="platform">
- <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
- </with>
- </enablement>
- </topic>
- </context>
-</contexts>
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/icons/sample.gif b/deprecated/org.eclipse.papyrus.sasheditor.ui/icons/sample.gif
deleted file mode 100644
index 34fb3c9..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/icons/sample.gif
+++ /dev/null
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/plugin.xml b/deprecated/org.eclipse.papyrus.sasheditor.ui/plugin.xml
deleted file mode 100644
index 8f36319..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/plugin.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-
- <extension
- point="org.eclipse.ui.views">
- <category
- name="Sash Windows"
- id="org.eclipse.papyrus.sasheditor.ui">
- </category>
- <view
- category="org.eclipse.papyrus.sasheditor.ui"
- class="org.eclipse.papyrus.sasheditor.ui.views.SashWindowsViewPart"
- icon="icons/sample.gif"
- id="org.eclipse.papyrus.sasheditor.ui.views.SashWindowsView"
- name="Sash Windows View">
- </view>
- </extension>
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.jdt.ui.JavaPerspective">
- <view
- ratio="0.5"
- relative="org.eclipse.ui.views.TaskList"
- relationship="right"
- id="org.eclipse.papyrus.sasheditor.ui.views.SashWindowsView">
- </view>
- </perspectiveExtension>
- </extension>
- <extension
- point="org.eclipse.help.contexts">
- <contexts
- file="contexts.xml">
- </contexts>
- </extension>
-
-</plugin>
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/Activator.java b/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/Activator.java
deleted file mode 100644
index 100b994..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/Activator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.papyrus.sasheditor.ui;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.papyrus.sasheditor.ui";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path
- * the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsView.java b/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsView.java
deleted file mode 100644
index f9f7907..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsView.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.ui.views;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-
-
-/**
- * An View (from MVC) used to render data from the SashWindows.
- * This view is implemented with SWT.
- *
- * @author cedric dumoulin
- */
-public class SashWindowsView {
-
- private FormToolkit toolkit;
-
- private ScrolledForm form;
-
- private Text selectedElement;
-
- private Text selectedPage;
-
- private Text selectedPageName;
-
- private Text selectedFolder;
-
- private Text selectedIEditor;
-
- private Text selectedIEditorName;
-
- private final String TITLE = "SashWindows";
-
- /**
- * Create associated part control.
- *
- * @param parent
- */
- public void createPartControl(Composite parent) {
- toolkit = new FormToolkit(parent.getDisplay());
- form = toolkit.createScrolledForm(parent);
- form.setText(TITLE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- form.getBody().setLayout(layout);
-
- //
- selectedElement = createInputText("Selected Element:", "");
- selectedPage = createInputText("selected Page:", "");
- selectedPageName = createInputText(" page name:", "");
- selectedFolder = createInputText("selected Folder:", "");
- selectedIEditor = createInputText("selected IEditor:", "");
- selectedIEditorName = createInputText(" editor name:", "");
-
- }
-
- /**
- * Create a Text with a label and an initial value.
- *
- * @param labelValue
- * @param textValue
- * @return
- */
- private Text createInputText(String labelValue, String textValue) {
- Text text;
- GridData gd = new GridData();
- Label label = toolkit.createLabel(form.getBody(), labelValue);
- label.setLayoutData(gd);
- text = toolkit.createText(form.getBody(), textValue, SWT.BORDER);
- text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- return text;
- }
-
- public void setselectedElement(String newText) {
- selectedElement.setText(newText);
- }
-
- public void setSelectedPage(String newText) {
- selectedPage.setText(newText);
- }
-
- public void setSelectedPageName(String newText) {
- selectedPageName.setText(newText);
- }
-
- public void setSelectedFolder(String newText) {
- selectedFolder.setText(newText);
- }
-
- public void setSelectedIEditor(String newText) {
- selectedIEditor.setText(newText);
- }
-
- public void setSelectedIEditorName(String newText) {
- selectedIEditorName.setText(newText);
- }
-
-
- /**
- * Dispose all resources
- */
- public void dispose() {
- toolkit.dispose();
- }
-
- /**
- * Set focus to this element.
- */
- public void setFocus() {
- form.setFocus();
- }
-
-}
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewModel.java b/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewModel.java
deleted file mode 100644
index ba95ca7..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewModel.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/**
- *
- */
-package org.eclipse.papyrus.sasheditor.ui.views;
-
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.sasheditor.editor.IPage;
-import org.eclipse.papyrus.sasheditor.editor.IPageChangedListener;
-import org.eclipse.papyrus.sasheditor.editor.ISashWindowsContainer;
-import org.eclipse.papyrus.sasheditor.editor.ISashWindowsContainerChangedListener;
-import org.eclipse.papyrus.sasheditor.editor.SashWindowsEventsProvider;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-
-
-/**
- * The model (from MVC) storing data to be shown by the ui.
- * Data owned :
- * <ul>
- * <li>selected element</li>
- * <li>current page (tabfolder)</li>
- * <li>current folder</li>
- * <li>current eclipse editor</li>
- * </ul>
- *
- * A faire:
- * - ecouter les evenements sash
- * - ecouter les evenements Eclipse selectionChanged
- * - envoyer evenement qd une valeur a change
- * - creer la classe ModelEvent indiquant le type d'evenement ?
- * - creer l'interface IModelEventListener permettant d'ecouter les events du model.
- * Q: une methode par event, ou alors un type dans l'event ?
- * - Completer la classe View avec la UI
- * - Completer ViewPart pour mettre le model et la UI en relation.
- *
- * Regarder les exemples dans SashWindowsViewOrig
- *
- * @author cedric dumoulin
- *
- */
-public class SashWindowsViewModel {
-
-
-
- /**
- * Interface implemented by classes wishing to be called when a change happen in the model.
- *
- * @author cedric dumoulin
- *
- */
- public interface IModelChangedListener {
-
- /**
- * This method is called when a value has changed in the model.
- *
- * @param changedModel
- * The model that has changed.
- */
- public void modelChanged(SashWindowsViewModel changedModel);
-
- }
-
- /**
- * List of listeners on model changed events.
- */
- private ListenersManager listenersManager = new ListenersManager();
-
-
- /** Object providing events on SashWindows life cycle. */
- private SashWindowsEventsProvider sashWindowEventsManager;
-
- /** Current editor shown by the view, or null */
- private IEditorPart currentEditor = null;
-
- /** The last selected element, or null */
- private Object selectedElement = null;
-
- /**
- * Listener on Eclipse selection changed.
- */
- private ISelectionChangedListener selectionChangedListener = new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- System.out.println(SashWindowsViewModel.this.getClass().getSimpleName() + ".selectionChanged(" + event + ")");
-
- SashWindowsViewModel.this.selectionChanged(event.getSelection());
- }
- };
-
- /**
- * Listener listening on pageChanged event.
- */
- private IPageChangedListener pageChangedListener = new IPageChangedListener() {
-
- public void pageChanged(IPage newPage) {
- System.out.println(SashWindowsViewModel.this.getClass().getSimpleName() + ".pageChanged(" + newPage + ")");
- selectionChanged();
- }
- };
-
- /**
- * Listener listening on containerChanged event.
- */
- private ISashWindowsContainerChangedListener containerChangedListener = new ISashWindowsContainerChangedListener() {
-
- public void sashWindowsContainerChanged(ISashWindowsContainer newContainer)
- {
- // Get the active editor, which should be the one owning the new page
- // Set it to null if the container is null.
- System.out.println(SashWindowsViewModel.this.getClass().getSimpleName() + ".sashWindowsContainerChanged(" + newContainer + ")");
-
- reconnectSelectionListener();
- }
- };
-
-
-
- /**
- *
- * Constructor.
- *
- * @param workbenchPage
- */
- public SashWindowsViewModel(IWorkbenchPage workbenchPage) {
- sashWindowEventsManager = new SashWindowsEventsProvider(workbenchPage);
-
- activateIncomingEventListeners();
- }
-
- /**
- * Dispose this model.
- * All resources are cleaned. The model should not be used again.
- */
- public void dispose() {
- deactivateIncomingEventListeners();
- sashWindowEventsManager.dispose();
- listenersManager.clear();
- }
-
-
- /**
- * Get the listener manager allowing to register / remove listeners.
- *
- * @return the listenersManager
- */
- public ListenersManager getListenersManager() {
- return listenersManager;
- }
-
- /**
- * Activate listeners on incoming events.
- */
- private void activateIncomingEventListeners() {
- sashWindowEventsManager.addPageChangedListener(pageChangedListener);
- sashWindowEventsManager.addSashWindowsContainerChangedListener(containerChangedListener);
- reconnectSelectionListener();
- }
-
- /**
- * Activate listeners on incoming events.
- */
- private void deactivateIncomingEventListeners() {
- disconnectSelectionListener();
- sashWindowEventsManager.removePageChangedListener(pageChangedListener);
- sashWindowEventsManager.removeSashWindowsContainerChangedListener(containerChangedListener);
- }
-
- /**
- * Connect the selection listener to the current IEditor (Eclipse editor).
- * Remove the listener from the previous editor if it is attached.
- */
- private void reconnectSelectionListener() {
- // Remove listening on all editor
- if(currentEditor != null) {
- currentEditor.getSite().getSelectionProvider().removeSelectionChangedListener(selectionChangedListener);
- }
-
- currentEditor = sashWindowEventsManager.activeSashWindowsContainerOwner();
- if(currentEditor != null) {
- currentEditor.getSite().getSelectionProvider().addSelectionChangedListener(selectionChangedListener);
- }
- }
-
- /**
- * Remove the listener from the previous editor if it is attached.
- */
- private void disconnectSelectionListener() {
- // Remove listening on all editor
- if(currentEditor != null) {
- currentEditor.getSite().getSelectionProvider().removeSelectionChangedListener(selectionChangedListener);
- }
- }
-
- /**
- * Trigger the event to registered listeners
- */
- private void fireChangedEvent() {
- listenersManager.fireChangedEvent(this);
- }
-
- /**
- * This method is called when the selection has changed.
- * This method lookup the selection.
- * TODO Hook this to Container changed instead of selection changed.
- */
- private void selectionChanged() {
- IEditorPart activeEditor = sashWindowEventsManager.activeSashWindowsContainerOwner();
- // Check if there is an active editor.
- if(activeEditor == null) {
- selectionChanged(null);
- return;
- }
-
- // Set the active selection
- ISelection selection = activeEditor.getSite().getSelectionProvider().getSelection();
- selectionChanged(selection);
- }
-
- /**
- * The selection has changed.
- *
- * @param selection
- */
- protected void selectionChanged(ISelection selection) {
-
- if(selection instanceof StructuredSelection) {
- StructuredSelection structuredSelection = (StructuredSelection)selection;
- selectedElement = structuredSelection.getFirstElement();
- } else {
- selectedElement = selection;
- }
-
- // Fire changed event.
- fireChangedEvent();
- }
-
-
- /**
- * Get the currently first selected element.
- *
- * @return The currently first selected element, or null if none is selected.
- */
- public Object getSelectedElement() {
- return selectedElement;
- }
-
- /**
- * Get the currently selected SashWindows Page
- *
- * @return The currently selected SashWindows Page, or null if none is selected.
- */
- public IPage getSelectedSashWindowsPage() {
- return sashWindowEventsManager.activeSashWindowsPage();
- }
-
- // /**
- // * Get the currently selected SashWindows Folder
- // * @return The currently selected SashWindows Page, or null if none is selected.
- // */
- // public IFolder getSelectedSashWindowsFolder()
- // {
- // return sashWindowEventsManager.SashWindowsFolder();
- // }
-
- /**
- * Get the currently selected SashWindows Page (IE.
- *
- * @return The currently selected SashWindows Page, or null if none is selected.
- */
- public IEditorPart getSelectedIEditorPart() {
- return sashWindowEventsManager.activeSashWindowsContainerOwner();
-
- }
-
- /**
- * Class used to register Listener and to send events to these listeners.
- *
- * @author cedric dumoulin
- *
- */
- public class ListenersManager extends ArrayList<IModelChangedListener> {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Add a listener that will be notified when the fireChangedEvent() method is called.
- *
- * @param listener
- */
- public void addModelChangedListener(IModelChangedListener listener) {
- add(listener);
- }
-
- /**
- * Remove a listener.
- *
- * @param listener
- */
- public void removeModelChangedListener(IModelChangedListener listener) {
- remove(listener);
- }
-
- /**
- * Fire the event to all registered listeners.
- */
- public void fireChangedEvent(SashWindowsViewModel changedModel) {
- for(IModelChangedListener listener : this) {
- listener.modelChanged(changedModel);
- }
- }
- }
-}
diff --git a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewPart.java b/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewPart.java
deleted file mode 100644
index f3ceff1..0000000
--- a/deprecated/org.eclipse.papyrus.sasheditor.ui/src/org/eclipse/papyrus/sasheditor/ui/views/SashWindowsViewPart.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.papyrus.sasheditor.ui.views;
-
-import org.eclipse.papyrus.sasheditor.editor.IPage;
-import org.eclipse.papyrus.sasheditor.ui.views.SashWindowsViewModel.IModelChangedListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.ViewPart;
-
-
-/**
- * An Eclipse View showing data from the SashWindows.
- * This class is an example showing how to have a UI following changes from editors
- * and sash windows.
- */
-
-public class SashWindowsViewPart extends ViewPart {
-
- /**
- * The ID of the view as specified by the extension.
- */
- public static final String ID = "org.eclipse.papyrus.sasheditor.ui.views.SashWindowsView";
-
- /** Class managing selected element rendering */
- private SashWindowsView figure;
-
- /** The model to be rendered */
- private SashWindowsViewModel model;
-
- /**
- * Listener on model changed events.
- */
- private IModelChangedListener modelChangedListener = new IModelChangedListener() {
-
- public void modelChanged(SashWindowsViewModel changedModel) {
- refreshView();
- }
- };
-
-
-
- /**
- * The constructor.
- */
- public SashWindowsViewPart() {
- }
-
-
- /**
- * Refresh the SWT view with values from the specified element
- */
- private void refreshView() {
-
- // selected element
- Object selectedElement = getModel().getSelectedElement();
- if(selectedElement != null) {
- figure.setselectedElement(selectedElement.toString());
- } else {
- figure.setselectedElement("");
- }
-
- // selected page
- IPage page = getModel().getSelectedSashWindowsPage();
- if(page != null) {
- figure.setSelectedPage(page.toString());
- figure.setSelectedPageName(page.getPageTitle());
- // figure.setSelectedPageIcon(page.getPageIcon());
- } else {
- figure.setSelectedPage("");
- figure.setSelectedPageName("");
- // figure.setSelectedPageIcon(null);
- }
-
- // selected folder
- // selectedElementViewer.setSelectedFolder(getModel().getSelectedFolder().toString());
- // selected Editor
- IEditorPart editor = getModel().getSelectedIEditorPart();
- if(editor != null) {
- figure.setSelectedIEditor(editor.toString());
- figure.setSelectedIEditorName(editor.getTitle());
- } else {
- figure.setSelectedIEditor("");
- figure.setSelectedIEditorName("");
- }
-
-
- }
-
- /**
- *
- * @return
- */
- private SashWindowsViewModel getModel() {
- return model;
- }
-
- /**
- * This is a callback that will allow us
- * to create the viewer and initialize it.
- */
- public void createPartControl(Composite parent) {
-
- Composite container = parent;
-
- figure = new SashWindowsView();
- figure.createPartControl(container);
- }
-
- /**
- * Initialize the view
- *
- * @see org.eclipse.ui.part.ViewPart#init(org.eclipse.ui.IViewSite)
- *
- * @param site
- * @throws PartInitException
- */
- @Override
- public void init(IViewSite site) throws PartInitException {
- super.init(site);
- model = new SashWindowsViewModel(site.getPage());
- model.getListenersManager().addModelChangedListener(modelChangedListener);
- }
-
- @Override
- public void dispose() {
- model.getListenersManager().removeModelChangedListener(modelChangedListener);
- model.dispose();
- figure.dispose();
- super.dispose();
- }
-
- /**
- * Passing the focus request to the viewer's control.
- */
- public void setFocus() {
- // viewer.getControl().setFocus();
- figure.setFocus();
- }
-
-}