From 18ba80f6021431bbeb6a8b99fc458e20270f925c Mon Sep 17 00:00:00 2001
From: cdumoulin
Date: Mon, 6 Feb 2012 17:22:14 +0000
Subject: 273413: [Usability][Navigation] Papyrus shall enable diagram
navigation history with back and next buttons
https://bugs.eclipse.org/bugs/show_bug.cgi?id=273413
Rollback to version 5569
keep commit 5750 bug 348689
keep refactoring
Remove all code related to navigation history
---
.../contentprovider/IAbstractPanelModel.java | 5 +-
.../contentprovider/IContentChangedListener.java | 16 +-
.../contentprovider/IContentChangedProvider.java | 8 +-
.../sasheditor/contentprovider/IEditorModel.java | 7 +-
.../core/sasheditor/contentprovider/IPageMngr.java | 49 +-
.../sasheditor/contentprovider/IPageModel.java | 11 +-
.../contentprovider/ISashPanelModel.java | 11 +-
.../ISashWindowsContentProvider.java | 67 +-
.../contentprovider/ITabFolderModel.java | 10 +-
.../contentprovider/simple/AbstractModel.java | 3 +
.../contentprovider/simple/AbstractPanelModel.java | 5 +
.../contentprovider/simple/SashPanelModel.java | 21 +-
.../simple/SimpleSashWindowsContentProvider.java | 67 +-
.../contentprovider/simple/TabFolderModel.java | 27 +-
.../singlefolder/SingleFolderContentProvider.java | 11 +-
.../singlefolder/SingleFolderModel.java | 11 +-
.../editor/AbstractMultiPageSashEditor.java | 71 +-
.../core/sasheditor/editor/IComponentPage.java | 9 +-
.../infra/core/sasheditor/editor/IEditorPage.java | 9 +-
.../sasheditor/editor/IMultiPageEditorPart.java | 8 +-
.../infra/core/sasheditor/editor/IPage.java | 11 +-
.../sasheditor/editor/IPageChangedListener.java | 2 +
.../infra/core/sasheditor/editor/IPageVisitor.java | 3 +
.../sasheditor/editor/ISashWindowsContainer.java | 32 +-
.../ISashWindowsContainerChangedListener.java | 2 +
.../editor/SashTabDecorationSynchronizer.java | 122 +--
.../editor/SashWindowsEventsProvider.java | 88 +-
.../ComposedActionBarContributor.java | 83 +-
.../IMultiPageEditorActionBarContributor.java | 14 +-
.../MultiPageEditorActionBarContributor.java | 10 +-
.../editor/gef/MultiDiagramEditorGefDelegate.java | 42 +-
.../sasheditor/internal/AbstractPanelPart.java | 32 +-
.../core/sasheditor/internal/AbstractPart.java | 11 +-
.../internal/ActiveEditorServicesSwitcher.java | 64 +-
.../sasheditor/internal/ActivePageTracker.java | 23 +-
.../core/sasheditor/internal/ComponentPart.java | 85 +-
.../infra/core/sasheditor/internal/Copyright.java | 1 +
.../sasheditor/internal/IMultiEditorManager.java | 25 +-
.../core/sasheditor/internal/IPanelParent.java | 7 +-
.../core/sasheditor/internal/IPartVisitor.java | 24 +-
.../LookupFolderPartByRawModelVisitor.java | 3 +
.../internal/LookupIPageByIEditorPartVisitor.java | 2 +
.../internal/LookupModelPageVisitor.java | 2 +
.../sasheditor/internal/NotFoundException.java | 2 +
.../infra/core/sasheditor/internal/PTabFolder.java | 80 +-
.../infra/core/sasheditor/internal/PagePart.java | 52 +-
.../sasheditor/internal/PageVisitorWrapper.java | 1 +
.../infra/core/sasheditor/internal/PartLists.java | 25 +-
.../core/sasheditor/internal/PartVisitor.java | 4 +
.../infra/core/sasheditor/internal/RootPart.java | 90 +-
.../internal/SashContainerEventsListener.java | 62 ++
.../internal/SashContainerEventsProvider.java | 15 +-
.../core/sasheditor/internal/SashPanelPart.java | 86 +-
.../sasheditor/internal/SashWindowsContainer.java | 1003 ++++++++++++++++++++
.../sasheditor/internal/SashWindowsException.java | 1 +
.../sasheditor/internal/ShowPartStatusVisitor.java | 17 +-
.../core/sasheditor/internal/TabFolderPart.java | 416 ++++----
.../core/sasheditor/internal/TabItemPart.java | 44 +-
.../eclipsecopy/AbstractTabFolderPart.java | 420 ++++----
.../eclipsecopy/MultiPageSelectionProvider.java | 34 +-
.../multipage/editor/MultiPageEditor.java | 113 +--
61 files changed, 2304 insertions(+), 1275 deletions(-)
create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashContainerEventsListener.java
create mode 100644 plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/SashWindowsContainer.java
(limited to 'plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src')
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IAbstractPanelModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IAbstractPanelModel.java
index 09e99acb271..93e77336ac7 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IAbstractPanelModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IAbstractPanelModel.java
@@ -4,12 +4,13 @@
package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
/**
- * A Panel represent a SashPanel or a TabFolder. This interface is the common
- * ancestor of the Panel models used in sash system.
+ * A Panel represent a SashPanel or a TabFolder.
+ * This interface is the common ancestor of the Panel models used in sash system.
*
* @author dumoulin
*
*/
public abstract interface IAbstractPanelModel {
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedListener.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedListener.java
index aa94ebacea2..1c967e113f3 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedListener.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedListener.java
@@ -3,19 +3,20 @@
*/
package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
+
/**
- * Interface to be implemented by classes needing to be notified when the
- * SashContent model has changed. This interface is not used by the
- * sashesWindows itself. It exists to allows ContentProvider implementation to
- * provide a common notification mechanism.
+ * Interface to be implemented by classes needing to be notified
+ * when the SashContent model has changed.
+ * This interface is not used by the sashesWindows itself. It exists to allows ContentProvider
+ * implementation to provide a common notification mechanism.
*
* @author dumoulin
*/
public interface IContentChangedListener {
/**
- * Event indicating the change. TODO The types are not set correctly from
- * user like DI model. But anyway there aren't used by clients.
+ * Event indicating the change.
+ * TODO The types are not set correctly from user like DI model. But anyway there aren't used by clients.
*
* @author dumoulin
*/
@@ -49,6 +50,7 @@ public interface IContentChangedListener {
this.object = object;
}
+
/**
* @return the type
*/
@@ -56,6 +58,7 @@ public interface IContentChangedListener {
return type;
}
+
/**
* @return the model
*/
@@ -63,6 +66,7 @@ public interface IContentChangedListener {
return model;
}
+
/**
* @return the object
*/
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedProvider.java
index f286b3afc54..656ea9e93b0 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IContentChangedProvider.java
@@ -1,9 +1,11 @@
package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
+
/**
- * Interface implemented by classes firing events when the ContentProvider
- * content change. This interface can be used by client of ContentProvider. It
- * is not use directly by the SashSystem.
+ * Interface implemented by classes firing events when the ContentProvider content
+ * change.
+ * This interface can be used by client of ContentProvider.
+ * It is not use directly by the SashSystem.
*
* @author dumoulin
*/
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IEditorModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IEditorModel.java
index d0af56907a0..15818dab2f8 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IEditorModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IEditorModel.java
@@ -26,16 +26,15 @@ import org.eclipse.ui.part.EditorActionBarContributor;
public interface IEditorModel extends IPageModel {
/**
- * Create the IEditor that should be shown. Editor life cycle methods are
- * not called.
+ * Create the IEditor that should be shown.
+ * Editor life cycle methods are not called.
*
* @return A new instance of the IEditor.
*/
public IEditorPart createIEditorPart() throws PartInitException;
/**
- * Get the EditorActionBarContributor that should be associated with the
- * editor .
+ * Get the EditorActionBarContributor that should be associated with the editor .
*
* @return
*/
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java
index 2e7511f8dfb..a408bb70a27 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageMngr.java
@@ -9,7 +9,6 @@
*
* Contributors:
* Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
- * Anass Radouani (Atos) - Add History management
*
*****************************************************************************/
@@ -17,31 +16,29 @@ package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
import java.util.List;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageChangedListener;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.SashContainerEventsListener;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.SashWindowsContainer;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer;
+
/**
- * Interface providing method to manage pages in the Sash Windows system. This
- * interface can be provided by ContentProvider whishing to provide a standard
- * way to manage pages. This interface is not mandatory for the Sasheditor. This
- * interface provide basic access to the Sash Windows system. It is intended to
- * be used from the application in order to interact with the ContentProvider.
- * Then, the {@link SashWindowsContainer} will refresh its views.
+ * Interface providing method to manage pages in the Sash Windows system.
+ * This interface can be provided by ContentProvider whishing to provide a standard
+ * way to manage pages. This interface is not mandatory for the Sasheditor.
+ * This interface provide basic access to the Sash Windows system.
+ * It is intended to be used from the application in order to interact with the ContentProvider. Then,
+ * the {@link SashWindowsContainer} will refresh its views.
*
*
* @author dumoulin
*/
-public interface IPageMngr extends IPageChangedListener, SashContainerEventsListener {
+public interface IPageMngr {
/**
* Add a Page identifier to the list of pages, do not open it.
*
* @param page
- * The object identifying the page to add. This object will be
- * passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This
- * identifier is stored in the sash model. It should be a
- * reference on a EMF object identifying the page.
+ * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This
+ * identifier is stored in the sash model.
+ * It should be a reference on a EMF object identifying the page.
*/
public void addPage(Object pageIdentifier);
@@ -55,14 +52,15 @@ public interface IPageMngr extends IPageChangedListener, SashContainerEventsList
public void removePage(Object pageIdentifier);
/**
- * Close the page corresponding to the identifier. The identifier is removed
- * from the Sash Windows, but not from the list of pages.
+ * Close the page corresponding to the identifier.
+ * The identifier is removed from the Sash Windows, but not from the list of pages.
*
* @param pageIdentifier
* The object identifying the page
*/
public void closePage(Object pageIdentifier);
+
/**
* Close all opened pages.
*
@@ -77,16 +75,16 @@ public interface IPageMngr extends IPageChangedListener, SashContainerEventsList
public void closeOtherPages(Object pageIdentifier);
/**
- * Open a Page corresponding to the identifier. If the page is not in the
- * list of pages, add it. The identifier is first added to the current
- * folder model. Then the Sash Windows should react and ask the {@link IPageModelFactory} to create the IPageModel. This later is then
- * used to create the SWT page. If
+ * Open a Page corresponding to the identifier. If the page is not in the list of pages, add it.
+ * The identifier is first added to the current folder model. Then the Sash Windows should react and
+ * ask the {@link IPageModelFactory} to create the IPageModel. This later is then used to create the
+ * SWT page.
+ * If
*
* @param page
- * The object identifying the page to add. This object will be
- * passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This
- * identifier is stored in the sash model. It should be a
- * reference on a EMF object identifying the page.
+ * The object identifying the page to add. This object will be passed to the {@link IPageModelFactory#createIPageModel(EObject)}. This
+ * identifier is stored in the sash model.
+ * It should be a reference on a EMF object identifying the page.
*/
public void openPage(Object pageIdentifier);
@@ -105,5 +103,4 @@ public interface IPageMngr extends IPageChangedListener, SashContainerEventsList
*/
public boolean isOpen(Object pageIdentifier);
-
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageModel.java
index 98739beaf17..9076761efb6 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/IPageModel.java
@@ -7,9 +7,10 @@ import org.eclipse.swt.graphics.Image;
/**
* This interface is the root of the hierarchy of models representing Pages.
- * This represent the final element shown in the sashes window. It can be an
- * Editor or a simple control. This interface is used by the sashes window to
- * interact with the model describing the element to be shown in the TabItem.
+ * This represent the final element shown in the sashes window.
+ * It can be an Editor or a simple control.
+ * This interface is used by the sashes window to interact with the model describing the element to be
+ * shown in the TabItem.
*
* @author dumoulin
*
@@ -31,8 +32,8 @@ public abstract interface IPageModel {
public Image getTabIcon();
/**
- * Get the raw model corresponding to this node. This is the object provided
- * to {@link ITabFolderModel.getChildren()}
+ * Get the raw model corresponding to this node.
+ * This is the object provided to {@link ITabFolderModel.getChildren()}
*
* @return
*/
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashPanelModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashPanelModel.java
index af353c760b8..982f9d3ba0c 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashPanelModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashPanelModel.java
@@ -3,9 +3,8 @@ package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
import java.util.List;
/**
- * A sash node contains two children separated by a sash. The sash can be moved,
- * resizing the children. This interface is used to specify that a sash with two
- * children should be drawn.
+ * A sash node contains two children separated by a sash. The sash can be moved, resizing the children.
+ * This interface is used to specify that a sash with two children should be drawn.
*
* @author dumoulin
*
@@ -20,9 +19,9 @@ public interface ISashPanelModel extends IAbstractPanelModel {
public List> getChildren();
/**
- * Create the Interface used to access the real model. This method is called
- * by the sashes window to get the interface. The method is called only once
- * for a given object.
+ * Create the Interface used to access the real model.
+ * This method is called by the sashes window to get the interface.
+ * The method is called only once for a given object.
*
* @param child
* A child returned by getChildren().
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashWindowsContentProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashWindowsContentProvider.java
index eb8c17206b6..72930fe979e 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashWindowsContentProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ISashWindowsContentProvider.java
@@ -1,12 +1,12 @@
package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
/**
- * This interface is used by the sash windows system to discover its content. It
- * is considered as the root of the sash windows models. The sashsystem is able
- * to retrieve all its content from this interface, and associated interfaces {@link ITabFolderModel}, {@link ISashPanelModel}, {@link IPageModel}.
- * The
- * interface is also used by the sashsystem to communicate, by sending event,
- * with the effective implementation or upper level.
+ * This interface is used by the sash windows system to discover its content. It is considered
+ * as the root of the sash windows models.
+ * The sashsystem is able to retrieve all its content from this interface, and associated interfaces {@link ITabFolderModel}, {@link ISashPanelModel},
+ * {@link IPageModel}.
+ * The interface is also used by the sashsystem to communicate, by sending event, with the
+ * effective implementation or upper level.
*
* @author dumoulin
*
@@ -14,10 +14,10 @@ package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
public interface ISashWindowsContentProvider {
/**
- * Get the root object shown in the sashes window. The type of the returned
- * object is left to the implementation. The sashes window will ask for an
- * interface used to interact with the object. In normal implementation,
- * this method should return the model used by the implementation.
+ * Get the root object shown in the sashes window.
+ * The type of the returned object is left to the implementation.
+ * The sashes window will ask for an interface used to interact with the object.
+ * In normal implementation, this method should return the model used by the implementation.
*
* @return The object representing the root of the sashes window.
*/
@@ -25,8 +25,8 @@ public interface ISashWindowsContentProvider {
/**
* create the interface used by the sashes window to access the root model.
- * This method is called by the sashes window to get the interface. The
- * method is called only once for a given object.
+ * This method is called by the sashes window to get the interface.
+ * The method is called only once for a given object.
*
* @param root
* @return The SashModel corresponding to the specified root object.
@@ -34,12 +34,12 @@ public interface ISashWindowsContentProvider {
public IAbstractPanelModel createChildSashModel(Object root);
/**
- * Add a page to the current TabFolder. The Page is added at the end of the
- * tab list.
+ * Add a page to the current TabFolder.
+ * The Page is added at the end of the tab list.
*
* @param page
- * An object identifying the page to add. The object could be
- * anything. It will be passed to the {@link ITabFolderModel#createChildSashModel(Object)} method.
+ * An object identifying the page to add. The object could be anything. It will be
+ * passed to the {@link ITabFolderModel#createChildSashModel(Object)} method.
*/
public void addPage(Object page);
@@ -47,8 +47,8 @@ public interface ISashWindowsContentProvider {
* Add a page at the specified index of TabFolder.
*
* @param page
- * An object identifying the page to add. The object could be
- * anything. It will be passed to the {@link ITabFolderModel#createChildSashModel(Object)} method.
+ * An object identifying the page to add. The object could be anything. It will be
+ * passed to the {@link ITabFolderModel#createChildSashModel(Object)} method.
* @param index
* Index to where the tabItem should be added.
*/
@@ -81,8 +81,8 @@ public interface ISashWindowsContentProvider {
public void removePage(int index);
/**
- * Remove the page from the sashes window. Look for the folder containing
- * the page.
+ * Remove the page from the sashes window.
+ * Look for the folder containing the page.
*
* @param page
* The Object identifying the page. This is the object used in {@link #addPage(Object)}.
@@ -97,11 +97,11 @@ public interface ISashWindowsContentProvider {
public void removePage(ITabFolderModel parentFolder, int tabIndex);
/**
- * Ask the model to move the specified tab to the specified side of the
- * specified targetFolder. This method is called by the the
- * SashTileContainer when the user have drag a tab in a correct place. The
- * SashTileContainer has not change is presentation yet. This will be done
- * when the corresponding event will occur.
+ * Ask the model to move the specified tab to the specified side of the specified targetFolder.
+ * This method
+ * is called by the the SashTileContainer when the user
+ * have drag a tab in a correct place. The SashTileContainer has not change is presentation yet. This
+ * will be done when the corresponding event will occur.
*
* @param tabFolder
* The folder containing the tab to move
@@ -110,22 +110,21 @@ public interface ISashWindowsContentProvider {
* @param targetFolder
* The folder to which the side refer to
* @param side
- * Side where node should be inserted : SWT.LEFT, SWT.RIGHT,
- * SWT.TOP, SWT.DOWN.
+ * Side where node should be inserted : SWT.LEFT, SWT.RIGHT, SWT.TOP, SWT.DOWN.
*/
public void createFolder(ITabFolderModel tabFolder, int tabIndex, ITabFolderModel targetFolder, int side);
/**
- * Ask the model to keep trace of the Current Folder. The notion of Current
- * Folder is used by {@link #addPage(Object)}. Calling this method should
- * not fire a Change Event.
+ * Ask the model to keep trace of the Current Folder.
+ * The notion of Current Folder is used by {@link #addPage(Object)}.
+ * Calling this method should not fire a Change Event.
*
- * This method is used by the SashSystem when the user select a new folder
- * by clicking on one of the tabs.
+ * This method is used by the SashSystem when the user select a new folder by clicking on one of
+ * the tabs.
*
* @param rawModel
- * The Raw model identifying the folder. This is the same object
- * as the one returned by {@link ISashPanelModel#getChildren()} when the child denote a folder.
+ * The Raw model identifying the folder. This is the same object as the one
+ * returned by {@link ISashPanelModel#getChildren()} when the child denote a folder.
*/
public void setCurrentFolder(Object rawModel);
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ITabFolderModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ITabFolderModel.java
index c1238b958f1..fe210fa33fb 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ITabFolderModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/ITabFolderModel.java
@@ -3,8 +3,8 @@ package org.eclipse.papyrus.infra.core.sasheditor.contentprovider;
import java.util.List;
/**
- * A folder containing tabItem. This interface is used to specify that a
- * TabFolder should be drawn.
+ * A folder containing tabItem.
+ * This interface is used to specify that a TabFolder should be drawn.
*
* @author dumoulin
*
@@ -22,9 +22,9 @@ public interface ITabFolderModel extends IAbstractPanelModel {
public List> getChildren();
/**
- * Create the Interface used to access the real model. This method is called
- * by the sashes window to get the interface. The method is called only once
- * for a given object.
+ * Create the Interface used to access the real model.
+ * This method is called by the sashes window to get the interface.
+ * The method is called only once for a given object.
*
* @param child
* A child returned by getChildren().
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractModel.java
index ce6f2fcda62..a17eab59db8 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractModel.java
@@ -13,11 +13,13 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
+
/**
* @author dumoulin
*/
public abstract class AbstractModel {
+
/**
* Return the parent of the model. Can be null in the case of rootModel.
*
@@ -25,6 +27,7 @@ public abstract class AbstractModel {
*/
abstract public AbstractModel getParent();
+
/**
* @param parent
* the parent to set
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractPanelModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractPanelModel.java
index c9cb164e529..0287d0c3458 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractPanelModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/AbstractPanelModel.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+
/**
* @author dumoulin
*/
@@ -35,6 +36,7 @@ public abstract class AbstractPanelModel extends AbstractModel implements IAbstr
this.parent = parent;
}
+
/**
* Return the parent of the model. Can be null in the case of rootModel.
*
@@ -44,6 +46,7 @@ public abstract class AbstractPanelModel extends AbstractModel implements IAbstr
return parent;
}
+
/**
* @param parent
* the parent to set
@@ -52,6 +55,7 @@ public abstract class AbstractPanelModel extends AbstractModel implements IAbstr
this.parent = parent;
}
+
/**
* Lookup the folder containing the specified tabItem.
*
@@ -60,4 +64,5 @@ public abstract class AbstractPanelModel extends AbstractModel implements IAbstr
*/
abstract protected TabFolderModel lookupTabFolder(IPageModel tabItem);
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SashPanelModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SashPanelModel.java
index e36ae91c710..e7a3935e6c9 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SashPanelModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SashPanelModel.java
@@ -20,6 +20,7 @@ import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IAbstractPanelM
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashPanelModel;
+
/**
* Simple implementation of the {@link ISashPanelModel}.
*
@@ -35,6 +36,8 @@ public class SashPanelModel extends AbstractPanelModel implements ISashPanelMode
protected int sashDirection;
+
+
/**
* @param children
* @param sashDirection
@@ -47,6 +50,7 @@ public class SashPanelModel extends AbstractPanelModel implements ISashPanelMode
this.sashDirection = sashDirection;
}
+
/**
* Set the left child.
*
@@ -83,10 +87,12 @@ public class SashPanelModel extends AbstractPanelModel implements ISashPanelMode
return children[1];
}
+
+
/**
- * Create the SashPanelModel from the raw model. In this implementation, the
- * rawModel is the SashPanelModel. This default implementation return
- * directly the child which is already of the appropriate type.
+ * Create the SashPanelModel from the raw model.
+ * In this implementation, the rawModel is the SashPanelModel.
+ * This default implementation return directly the child which is already of the appropriate type.
*/
public IAbstractPanelModel createChildSashModel(Object rawModel) {
return (IAbstractPanelModel)rawModel;
@@ -112,6 +118,7 @@ public class SashPanelModel extends AbstractPanelModel implements ISashPanelMode
*/
public void replaceChild(AbstractPanelModel oldChild, AbstractPanelModel newChild) {
+
if(getLeftChild() == oldChild)
setLeftChild(newChild);
else if(getRightChild() == oldChild)
@@ -119,6 +126,7 @@ public class SashPanelModel extends AbstractPanelModel implements ISashPanelMode
}
+
/**
*
* {@inheritDoc}
@@ -132,9 +140,10 @@ public class SashPanelModel extends AbstractPanelModel implements ISashPanelMode
return getRightChild().lookupTabFolder(tabItem);
}
+
/**
- * Delete the sashModel. The childToDelete is removed from the tree, bypass
- * the sashnode : the other child parent is set to sashnode parent.
+ * Delete the sashModel.
+ * The childToDelete is removed from the tree, bypass the sashnode : the other child parent is set to sashnode parent.
*
* @param tabFolder
*/
@@ -148,6 +157,8 @@ public class SashPanelModel extends AbstractPanelModel implements ISashPanelMode
otherChild.setParent(parent);
parent.replaceChild(this, otherChild);
+
}
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java
index d87ee839e65..9f2163a28de 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/SimpleSashWindowsContentProvider.java
@@ -23,12 +23,12 @@ import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener.ContentEvent;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.SashWindowsContainer;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer;
import org.eclipse.swt.SWT;
/**
- * A simple implementation of providers allowing sashes and folders. The tabs
- * can be added and removed.
+ * A simple implementation of providers allowing sashes and folders.
+ * The tabs can be added and removed.
*
* @author dumoulin
*
@@ -54,6 +54,7 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
rootModel = new RootModel(currentTabFolder);
}
+
/**
* Add a listener listening on content changed. This listener will be
* notified each time the content change.
@@ -126,8 +127,8 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
}
/**
- * Move a tab from folder to folder. The change event is sent only once
- * after the complete operation is performed. {@inheritDoc}
+ * Move a tab from folder to folder.
+ * The change event is sent only once after the complete operation is performed. {@inheritDoc}
*/
public void movePage(ITabFolderModel srcFolderModel, int sourceIndex, ITabFolderModel targetFolderModel, int targetIndex) {
// This implementation use (TabFolderModel), so we can cast safely
@@ -168,41 +169,29 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
}
/**
- * Create a new folder and insert it at the specified side. Move the
- * specified tab into the created Folder.
+ * Create a new folder and insert it at the specified side. Move the specified tab into the created Folder.
*
- * The change event is sent only once after the complete operation is
- * performed. {@inheritDoc}
+ * The change event is sent only once after the complete operation is performed. {@inheritDoc}
*
- * @param referenceFolder
- * The folder used as reference to insert the newly created
- * Folder.
- * @param side
- * The side to which the created folder is inserted. Can be
- * SWT.TOP, DOWN, LEFT, RIGHT.
+ * @param referenceFolder The folder used as reference to insert the newly created Folder.
+ * @param side The side to which the created folder is inserted. Can be SWT.TOP, DOWN, LEFT, RIGHT.
*/
public void createFolder(ITabFolderModel sourceFolder, int tabIndex, ITabFolderModel referenceFolder, int side) {
org.eclipse.papyrus.infra.core.sasheditor.Activator.log.debug("createFolder()");
ITabFolderModel newFolder = doCreateFolder((TabFolderModel)sourceFolder, tabIndex, (TabFolderModel)referenceFolder, side);
contentChangedListenerManager.fireContentChanged(new ContentEvent(ContentEvent.CHANGED, this, sourceFolder));
- // return newFolder;
+ // return newFolder;
}
/**
- * Create a new folder and insert it at the specified side of the reference
- * folder. The change event is sent only once after the complete operation
- * is performed.
+ * Create a new folder and insert it at the specified side of the reference folder.
+ * The change event is sent only once after the complete operation is performed.
*
- * This method is not part of the {@link SashWindowsContainer} API. It is
- * here to help writing junit tests.
+ * This method is not part of the {@link SashWindowsContainer} API. It is here to help writing junit tests.
*
- * @param referenceFolder
- * The folder used as reference to insert the newly created
- * Folder.
- * @param side
- * The side to which the created folder is inserted. Can be
- * SWT.TOP, DOWN, LEFT, RIGHT.
+ * @param referenceFolder The folder used as reference to insert the newly created Folder.
+ * @param side The side to which the created folder is inserted. Can be SWT.TOP, DOWN, LEFT, RIGHT.
*/
public ITabFolderModel createFolder(ITabFolderModel referenceFolder, int side) {
org.eclipse.papyrus.infra.core.sasheditor.Activator.log.debug("createFolder()");
@@ -213,8 +202,8 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
}
/**
- * Move a tab from folder to folder. The change event is sent only once
- * after the complete operation is performed.
+ * Move a tab from folder to folder.
+ * The change event is sent only once after the complete operation is performed.
*
* @return The moved tab.
*/
@@ -226,9 +215,9 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
}
/**
- * Move a tab from folder to folder. The tab is added at the end of the
- * target folder. The change event is sent only once after the complete
- * operation is performed. {@inheritDoc}
+ * Move a tab from folder to folder.
+ * The tab is added at the end of the target folder.
+ * The change event is sent only once after the complete operation is performed. {@inheritDoc}
*/
private void doMoveTab(TabFolderModel srcFolderModel, int sourceIndex, TabFolderModel targetFolderModel) {
@@ -290,8 +279,8 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
}
/**
- * Insert the folderToInsert on the specified side of the refFolder. Create
- * and insert the requested SashModel.
+ * Insert the folderToInsert on the specified side of the refFolder. Create and insert the
+ * requested SashModel.
*
* @param folderToInsert
* @param refFolder
@@ -381,10 +370,9 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
* Lookup the folder containing the specified tabItem.
*
* @param tabItem
- * Item for which a folder is looked for. If the item is null,
- * return the first folder encountered.
- * @return The folder containing the item, or the first encountered folder
- * if item is null.
+ * Item for which a folder is looked for. If the item is null, return
+ * the first folder encountered.
+ * @return The folder containing the item, or the first encountered folder if item is null.
*/
private TabFolderModel lookupPageFolder(IPageModel tabItem) {
return rootModel.lookupTabFolder(tabItem);
@@ -424,8 +412,7 @@ public class SimpleSashWindowsContentProvider implements ISashWindowsContentProv
* @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider#setCurrentFolder(java.lang.Object)
*
* @param rawModel
- * Object identifying the current folder. In this implementation,
- * the object is the FolderModel.
+ * Object identifying the current folder. In this implementation, the object is the FolderModel.
*/
public void setCurrentFolder(Object rawModel) {
if(!(rawModel instanceof TabFolderModel)) {
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/TabFolderModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/TabFolderModel.java
index 67ce0bff0ed..79b89c0809b 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/TabFolderModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/simple/TabFolderModel.java
@@ -55,12 +55,10 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
}
/**
- * This default implementation return directly the child which is already of
- * the appropriate type.
+ * This default implementation return directly the child which is already of the appropriate type.
*/
public IPageModel createChildSashModel(Object child) {
- // In this default implementation, the child is already of the
- // appropriate type.
+ // In this default implementation, the child is already of the appropriate type.
return (IPageModel)child;
}
@@ -109,8 +107,8 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
}
/**
- * Move a tab inside the folder. Moves the tab from the old position to the
- * new position.
+ * Move a tab inside the folder.
+ * Moves the tab from the old position to the new position.
*
* @param oldIndex
* the position of the tab before the move.
@@ -132,6 +130,7 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
if(listSize == 0)
return;
+
// Move
IPageModel toMove = children.remove(oldIndex);
children.add(newIndex, toMove);
@@ -139,7 +138,8 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
}
/**
- * Add a new model. Do not fire change Event
+ * Add a new model.
+ * Do not fire change Event
*
* @param newModel
*/
@@ -148,7 +148,8 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
}
/**
- * Add a model at the specified position. Do not fire change Event
+ * Add a model at the specified position.
+ * Do not fire change Event
*
* @param index
* @param newModel
@@ -161,7 +162,8 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
}
/**
- * Remove the specified tab. Do not fire change Event
+ * Remove the specified tab.
+ * Do not fire change Event
*
* @param index
* @return
@@ -193,7 +195,8 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
}
/**
- * Remove the specified tab. Do not fire change Event
+ * Remove the specified tab.
+ * Do not fire change Event
*
* @param tabItem
*/
@@ -214,8 +217,8 @@ public class TabFolderModel extends AbstractPanelModel implements ITabFolderMode
* Get a folder by one of its tab.
*
* @param tabItem
- * Item for which a folder is looked for. If the item is null,
- * return the first folder encountered.
+ * Item for which a folder is looked for. If the item is null, return
+ * the first folder encountered.
* @return The folder if it contains the item, or if item is null.
*/
@Override
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java
index 6ac26058385..3099e3853a3 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderContentProvider.java
@@ -25,8 +25,8 @@ import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ITabFolderModel
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IContentChangedListener.ContentEvent;
/**
- * A simple implementation of providers allowing only one single folder
- * containing tabs. The tabs can be added and removed.
+ * A simple implementation of providers allowing only one single folder containing tabs.
+ * The tabs can be added and removed.
*
* @author dumoulin
*/
@@ -154,8 +154,7 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider,
}
/**
- * Remove the specified tab. As we have only one folder, this should be from
- * the currentFolder {@inheritDoc}
+ * Remove the specified tab. As we have only one folder, this should be from the currentFolder {@inheritDoc}
*/
public void removePage(ITabFolderModel parentFolder, int tabIndex) {
removePage(tabIndex);
@@ -252,8 +251,8 @@ public class SingleFolderContentProvider implements ISashWindowsContentProvider,
}
/**
- * Move a tab from folder to folder. As this implementation has only one
- * folder, this can't happen. Do nothing. {@inheritDoc}
+ * Move a tab from folder to folder.
+ * As this implementation has only one folder, this can't happen. Do nothing. {@inheritDoc}
*/
public void movePage(ITabFolderModel srcFolderModel, int sourceIndex, ITabFolderModel targetFolderModel, int targetIndex) {
return;
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderModel.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderModel.java
index 482b7391783..cd1e4274d0b 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderModel.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/contentprovider/singlefolder/SingleFolderModel.java
@@ -53,12 +53,10 @@ public class SingleFolderModel implements ITabFolderModel {
}
/**
- * This default implementation return directly the child which is already of
- * the appropriate type.
+ * This default implementation return directly the child which is already of the appropriate type.
*/
public IPageModel createChildSashModel(Object child) {
- // In this default implementation, the child is already of the
- // appropriate type.
+ // In this default implementation, the child is already of the appropriate type.
return (IPageModel)child;
}
@@ -107,8 +105,8 @@ public class SingleFolderModel implements ITabFolderModel {
}
/**
- * Move a tab inside the folder. Moves the tab from the old position to the
- * new position.
+ * Move a tab inside the folder.
+ * Moves the tab from the old position to the new position.
*
* @param oldIndex
* the position of the tab before the move.
@@ -131,6 +129,7 @@ public class SingleFolderModel implements ITabFolderModel {
if(listSize == 0)
return;
+
// Move
IPageModel toMove = itemModels.remove(oldIndex);
itemModels.add(newIndex, toMove);
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/AbstractMultiPageSashEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/AbstractMultiPageSashEditor.java
index 3dd300d0143..5ea52fde209 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/AbstractMultiPageSashEditor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/AbstractMultiPageSashEditor.java
@@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.ISashWindowsContentProvider;
import org.eclipse.papyrus.infra.core.sasheditor.internal.IMultiEditorManager;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer;
import org.eclipse.papyrus.infra.core.sasheditor.internal.eclipsecopy.MultiPageSelectionProvider;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
@@ -30,8 +31,7 @@ import org.eclipse.ui.internal.util.Util;
import org.eclipse.ui.part.EditorPart;
/**
- * Base editor that can be subclassed to provide a multi page editor with sash
- * windows.
+ * Base editor that can be subclassed to provide a multi page editor with sash windows.
*
* @author dumoulin
*/
@@ -62,8 +62,7 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
}
/**
- * Set the contentProvider if not set. If it is already set, this method do
- * not change it.
+ * Set the contentProvider if not set. If it is already set, this method do not change it.
*
* @param contentProvider
*/
@@ -74,27 +73,23 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
}
/**
- * Create the provider. Subclass must implements this method. It should
- * return the provider used by the editor.
+ * Create the provider.
+ * Subclass must implements this method. It should return the provider used by the editor.
*
*/
abstract protected ISashWindowsContentProvider createPageProvider();
/**
- * Handles a property change notification from a nested editor. The default
- * implementation simply forwards the change to listeners on this multi-page
- * editor by calling firePropertyChange
with the same property
- * id. For example, if the dirty state of a nested editor changes (property
- * id IEditorPart.PROP_DIRTY
), this method handles it by firing
- * a property change event for IEditorPart.PROP_DIRTY
to
- * property listeners on this multi-page editor.
+ * Handles a property change notification from a nested editor. The default implementation simply forwards the change to
+ * listeners on this multi-page editor by calling firePropertyChange
with the same property id. For example, if
+ * the dirty state of a nested editor changes (property id IEditorPart.PROP_DIRTY
), this method handles it
+ * by firing a property change event for IEditorPart.PROP_DIRTY
to property listeners on this multi-page
+ * editor.
*
* Subclasses may extend or reimplement this method. *
* - * @copiedfrom - * org.eclipse.ui.part.MultiPageEditorPart.handlePropertyChange(int - * ) + * @copiedfrom org.eclipse.ui.part.MultiPageEditorPart.handlePropertyChange(int) * * @param propertyId * the id of the property that changed @@ -104,9 +99,9 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements } /** - * TheMultiPageEditorPart
implementation of this IEditorPart
method sets its site to the given site, its
- * input to the given input, and the site's selection provider to a MultiPageSelectionProvider
. Subclasses may extend this
- * method.
+ * The MultiPageEditorPart
implementation of this IEditorPart
method sets its site to the given
+ * site, its input to the given input, and the site's selection provider to a MultiPageSelectionProvider
.
+ * Subclasses may extend this method.
*
* @copiedfrom org.eclipse.ui.part.MultiPageEditorPart
* @param site
@@ -137,9 +132,9 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
}
/**
- * Method to activate the editor. Called immediately after
- * createPartControl() is complete. To be implemented by subclasses. Default
- * implementation do nothing.
+ * Method to activate the editor.
+ * Called immediately after createPartControl() is complete.
+ * To be implemented by subclasses. Default implementation do nothing.
*/
protected void activate() {
@@ -147,8 +142,9 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
}
/**
- * Method to deactivate the editor. Called when dispose() is called. To be
- * implemented by subclasses. Default implementation do nothing.
+ * Method to deactivate the editor.
+ * Called when dispose() is called.
+ * To be implemented by subclasses. Default implementation do nothing.
*/
protected void deactivate() {
@@ -178,9 +174,8 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
}
/**
- * If there is an adapter registered against the subclass of
- * MultiPageEditorPart return that. Otherwise, delegate to the internal
- * editor.
+ * If there is an adapter registered against the subclass of MultiPageEditorPart return that. Otherwise, delegate to the
+ * internal editor.
*
* @copiedfrom org.eclipse.ui.part.MultiPageEditorPart
*
@@ -221,8 +216,8 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
}
/**
- * Get the {@link ISashWindowsContainer}. Note the the ISashWindowsContainer
- * can also be acuired with getAdapter(ISashWindowsContainer.class).
+ * Get the {@link ISashWindowsContainer}.
+ * Note the the ISashWindowsContainer can also be acuired with getAdapter(ISashWindowsContainer.class).
*/
public ISashWindowsContainer getISashWindowsContainer() {
return sashContainer;
@@ -243,16 +238,15 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
*
* {@inheritDoc}
*
- * TODO Move this method aways. This method is too tightly coupled to the
- * Papyrus GMF UML IEditor. It doesn't work on other kind of IEditor. It
- * introduce problems in IEditor of other kinds
+ * TODO Move this method aways. This method is too tightly coupled to the Papyrus GMF UML IEditor.
+ * It doesn't work on other kind of IEditor. It introduce problems in IEditor of other kinds
*
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer#isDirty()
* @deprecated A SaveAndDirtyService is used instead.
*/
@Override
public boolean isDirty() {
- // return sashContainer.isDirty();
+ // return sashContainer.isDirty();
EditorVisitor visitor = new EditorVisitor();
sashContainer.visit(visitor);
@@ -269,14 +263,12 @@ public abstract class AbstractMultiPageSashEditor extends EditorPart implements
* Notify all the editors that the multi editor has been saved.AbstractMultiPageSashEditor
implementation of this IWorkbenchPart
method sets focus on the active nested
* editor, if there is one.
@@ -49,7 +51,8 @@ public interface ISashWindowsContainer {
public abstract void setFocus();
/**
- * Refresh the SashWindows. Synchronize the internal structure with the {@link ISashWindowsContentProvider}.
+ * Refresh the SashWindows.
+ * Synchronize the internal structure with the {@link ISashWindowsContentProvider}.
*/
public abstract void refreshTabs();
@@ -68,8 +71,8 @@ public interface ISashWindowsContainer {
public abstract void removePageChangedListener(IPageChangedListener pageChangedListener);
/**
- * Add a listener on Page LifeCycle events. This implementation delegates to
- * the internal PageTracker.
+ * Add a listener on Page LifeCycle events.
+ * This implementation delegates to the internal PageTracker.
*
* @see org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer#addPageChangedListener(org.eclipse.papyrus.infra.core.sasheditor.editor.IPageChangedListener)
* @param listener
@@ -85,14 +88,9 @@ public interface ISashWindowsContainer {
*
*/
public void removeLifeCycleListener(SashContainerEventsListener listener);
-
/**
- * Set a {@link MenuManager} used to manage a contextual menu that is shown
- * on the tabs area of the folders.
- *
- * @param menuManager
- * The {@link MenuManager} used to create the menu on the tab
- * area.
+ * Set a {@link MenuManager} used to manage a contextual menu that is shown on the tabs area of the folders.
+ * @param menuManager The {@link MenuManager} used to create the menu on the tab area.
*/
- public abstract void setFolderTabMenuManager(MenuManager menuManager);
+ public abstract void setFolderTabMenuManager( MenuManager menuManager );
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/ISashWindowsContainerChangedListener.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/ISashWindowsContainerChangedListener.java
index 4b9e0f5c99d..a387aa8217b 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/ISashWindowsContainerChangedListener.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/ISashWindowsContainerChangedListener.java
@@ -3,6 +3,8 @@
*/
package org.eclipse.papyrus.infra.core.sasheditor.editor;
+
+
/**
* @author dumoulin
*
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashTabDecorationSynchronizer.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashTabDecorationSynchronizer.java
index 5e480d5f43e..7286dab9ffd 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashTabDecorationSynchronizer.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashTabDecorationSynchronizer.java
@@ -5,60 +5,64 @@ package org.eclipse.papyrus.infra.core.sasheditor.editor;
import java.util.logging.Logger;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.SashContainerEventsListener;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.IWorkbenchPart;
+
/**
- * This class take care to refresh a Sash Tab (name and icon) when its model
- * change. The class listen to IEditor property change, and refresh the
- * corresponding tab accordingly. The class also listen on {@link SashWindowsContainer} page's life cycle in order to attach/remove the
- * listener on pages.
+ * This class take care to refresh a Sash Tab (name and icon) when its model change.
+ * The class listen to IEditor property change, and refresh the corresponding tab
+ * accordingly.
+ * The class also listen on {@link SashWindowsContainer} page's life cycle in order to
+ * attach/remove the listener on pages.
*
- * The class can be extended.
+ * The class can be extended.
*
* @author cedric dumoulin
- *
+ *
*/
public class SashTabDecorationSynchronizer {
/**
* Logger for debug purpose.
*/
- Logger log = Logger.getLogger(this.getClass().getName());
-
+ Logger log = Logger.getLogger(this.getClass().getName() );
+
/**
* The container to synchronize.
*/
private SashWindowsContainer container;
-
+
/**
* Listener on Container'pages life cycle.
*/
SashContainerEventsListener pageLifeCycleListener = new SashContainerEventsListener() {
-
+
public void pageChanged(IPage newPage) {
}
-
+
public void pageOpened(IPage page) {
attachPage(page);
-
+
}
-
+
public void pageDeactivated(IPage page) {
}
-
+
public void pageClosed(IPage page) {
detachPage(page);
-
+
}
-
+
public void pageActivated(IPage page) {
}
-
+
public void pageAboutToBeOpened(IPage page) {
}
-
+
public void pageAboutToBeClosed(IPage page) {
}
};
@@ -67,29 +71,28 @@ public class SashTabDecorationSynchronizer {
* Listener on changes of an {@link IEditorPart}
*/
private IPropertyListener editorPartPropertyListener = new IPropertyListener() {
-
+
public void propertyChanged(Object source, int propId) {
- if(propId == IWorkbenchPart.PROP_TITLE && source instanceof IEditorPart) {
+ if(propId == IWorkbenchPart.PROP_TITLE && source instanceof IEditorPart )
+ {
refreshContainerTabForPage((IEditorPart)source);
}
-
+
}
};
/**
*
* Constructor.
- *
- * @param container
- * The container to synchronize.
+ * @param container The container to synchronize.
*
*/
- public SashTabDecorationSynchronizer(SashWindowsContainer container) {
+ public SashTabDecorationSynchronizer( SashWindowsContainer container) {
this.container = container;
attachContainerPages();
attachListeners();
}
-
+
/**
* Detach any listeners.
*/
@@ -97,42 +100,42 @@ public class SashTabDecorationSynchronizer {
detachListeners();
detachContainerPages();
}
-
+
/**
* Attach listeners requested by the class.
*/
protected void attachListeners() {
container.addLifeCycleListener(pageLifeCycleListener);
}
-
+
/**
* Detach listeners requested by the class.
*/
protected void detachListeners() {
container.removeLifeCycleListener(pageLifeCycleListener);
}
-
+
/**
* Start listening on change for the specified page.
- *
* @param page
*/
protected void attachPage(IPage page) {
- if(page instanceof IEditorPage) {
+ if( page instanceof IEditorPage )
+ {
log.fine("attachPage( " + page + " )");
IEditorPage editorPage = (IEditorPage)page;
editorPage.getIEditorPart().addPropertyListener(editorPartPropertyListener);
}
-
+
}
/**
* Stop listening onchange for the specified page.
- *
* @param page
*/
protected void detachPage(IPage page) {
- if(page instanceof IEditorPage) {
+ if( page instanceof IEditorPage )
+ {
log.fine("attachPage( " + page + " )");
IEditorPage editorPage = (IEditorPage)page;
editorPage.getIEditorPart().removePropertyListener(editorPartPropertyListener);
@@ -143,25 +146,24 @@ public class SashTabDecorationSynchronizer {
// lookup page
IPage page = container.lookupIPageByIEditorPart(source);
refreshContainerTabForPage(page);
-
+
}
/**
* Refresh the tab for the specified page
- *
* @param page
*/
- protected void refreshContainerTabForPage(IPage page) {
+ protected void refreshContainerTabForPage( IPage page ) {
container.refreshPageTab(page);
}
-
+
/**
* Iterate on pages owned by the container, and call detachPage for each.
*/
private void detachContainerPages() {
// Visit all pages of the container.
container.visit(new DetachVisitor());
-
+
}
/**
@@ -170,42 +172,40 @@ public class SashTabDecorationSynchronizer {
private void attachContainerPages() {
// Visit all pages of the container.
container.visit(new AttachVisitor());
-
+
}
/**
* Visitor to visit all pages of the container and attach the page.
- *
* @author dumoulin
- *
+ *
*/
- private class AttachVisitor implements IPageVisitor {
-
- public void accept(IComponentPage page) {
- }
-
- public void accept(IEditorPage page) {
- attachPage(page);
-
- }
+ private class AttachVisitor implements IPageVisitor {
+ public void accept(IComponentPage page) {
}
+ public void accept(IEditorPage page) {
+ attachPage(page);
+
+ }
+
+ }
+
/**
* Visitor to visit all pages of the container and attach the page.
- *
* @author dumoulin
- *
+ *
*/
- private class DetachVisitor implements IPageVisitor {
+ private class DetachVisitor implements IPageVisitor {
- public void accept(IComponentPage page) {
- }
-
- public void accept(IEditorPage page) {
- detachPage(page);
-
- }
+ public void accept(IComponentPage page) {
+ }
+ public void accept(IEditorPage page) {
+ detachPage(page);
+
}
+
+ }
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashWindowsEventsProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashWindowsEventsProvider.java
index 537a2c5656e..d43ecb505ad 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashWindowsEventsProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/SashWindowsEventsProvider.java
@@ -6,6 +6,7 @@ package org.eclipse.papyrus.infra.core.sasheditor.editor;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPage;
@@ -18,12 +19,10 @@ import org.eclipse.ui.IWorkbenchPart;
* IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ * Constructor.
+ * Page can be acquired with : IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
*/
public SashWindowsEventsProvider(IWorkbenchPage page) {
@@ -129,19 +126,18 @@ public class SashWindowsEventsProvider {
newContainer = (ISashWindowsContainer)editorPart.getAdapter(ISashWindowsContainer.class);
}
- // // Set SashContainer and ActivePage
- // currentContainer = newContainer;
- // if( currentContainer != null)
- // {
- // activePage = newContainer.getActiveSashWindowsPage();
- // System.err.println("activePage=" + activePage.getPageTitle()
- // + ", tab index=" + currentContainer.);
- // }
+ // // Set SashContainer and ActivePage
+ // currentContainer = newContainer;
+ // if( currentContainer != null)
+ // {
+ // activePage = newContainer.getActiveSashWindowsPage();
+ // System.err.println("activePage=" + activePage.getPageTitle()
+ // + ", tab index=" + currentContainer.);
+ // }
}
/**
- * Return the currently active ISashWindowsContainer or null if none is
- * actif.
+ * Return the currently active ISashWindowsContainer or null if none is actif.
*
* @return
*/
@@ -150,8 +146,8 @@ public class SashWindowsEventsProvider {
}
/**
- * Return the currently active {@link IEditorPart} owning the currently
- * active ISashWindowsContaineror. Return null if no container is actif.
+ * Return the currently active {@link IEditorPart} owning the currently active ISashWindowsContaineror.
+ * Return null if no container is actif.
*
* @return
*/
@@ -162,8 +158,8 @@ public class SashWindowsEventsProvider {
}
/**
- * Return the currently active page associated to the currently active
- * Container. Return null if no container is actif.
+ * Return the currently active page associated to the currently active Container.
+ * Return null if no container is actif.
*
* @return
*/
@@ -192,9 +188,9 @@ public class SashWindowsEventsProvider {
}
/**
- * Register a listener listeneing on editor change. Page can be acuired with
- * : IWorkbenchPage page =
- * PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ * Register a listener listeneing on editor change.
+ * Page can be acuired with :
+ * IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
*/
private void registerEditorChangedListener() {
@@ -202,9 +198,9 @@ public class SashWindowsEventsProvider {
}
/**
- * This method is called when the active editor has change. The method
- * checks the new editor and send appropriate events. The editor can be
- * null.
+ * This method is called when the active editor has change.
+ * The method checks the new editor and send appropriate events.
+ * The editor can be null.
*
* @param newEditor
* The new editor of null if none is set.
@@ -224,9 +220,8 @@ public class SashWindowsEventsProvider {
}
/**
- * This method is called when the active container has changed. The
- * pageChangedListener is removed from the oldContainer, and attached to the
- * newContainer.
+ * This method is called when the active container has changed.
+ * The pageChangedListener is removed from the oldContainer, and attached to the newContainer.
*
* @param newContainer
*/
@@ -251,8 +246,8 @@ public class SashWindowsEventsProvider {
}
/**
- * Send an event indicating a containerChanged. Propagate the event to all
- * the listeners.
+ * Send an event indicating a containerChanged.
+ * Propagate the event to all the listeners.
*
* @param activeEditor
*/
@@ -262,8 +257,8 @@ public class SashWindowsEventsProvider {
}
/**
- * Send an event indicating a pageChanged. Propagate the event to all the
- * listeners.
+ * Send an event indicating a pageChanged.
+ * Propagate the event to all the listeners.
*
* @param activeEditor
*/
@@ -405,8 +400,7 @@ public class SashWindowsEventsProvider {
}
/**
- * A list of {@link ISashWindowsContainerChangedListener} listening on
- * container changed event.
+ * A list of {@link ISashWindowsContainerChangedListener} listening on container changed event.
*
* @author dumoulin
*
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java
index a5c7626003e..a213d0e8b05 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/ComposedActionBarContributor.java
@@ -9,34 +9,34 @@ import org.eclipse.ui.IEditorActionBarContributor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.part.EditorActionBarContributor;
+
/**
*
* An ActionBarContributor composed of ActionBarContributor from multi editor.
- * This ActionBarContributor switch to the contributor dedicated to the active
- * editor in a MultiPageEditor environement.
+ * This ActionBarContributor switch to the contributor dedicated to the active editor in
+ * a MultiPageEditor environement.
*
* @author dumoulin
*
*/
public class ComposedActionBarContributor extends MultiPageEditorActionBarContributor {
- // /**
- // * List of contributors.
- // */
- // protected ContributorMapnull
if there is no
- * active page, or if the active page does not have a
- * corresponding editor
+ * the new active editor, or null
if there is no active page, or if the
+ * active page does not have a corresponding editor
*/
@Override
public void setActivePage(IEditorPart activeEditor) {
@@ -77,9 +76,9 @@ public class ComposedActionBarContributor extends MultiPageEditorActionBarContri
activeNestedEditor = activeEditor;
- // System.out.println(this.getClass().getSimpleName()
- // + ".setActivePage(" + activeEditor
- // + ") :" + getActiveContributor());
+// System.out.println(this.getClass().getSimpleName()
+// + ".setActivePage(" + activeEditor
+// + ") :" + getActiveContributor());
// Propagate call if possible
// Call setActiveEditor() on nested contributor.
@@ -87,9 +86,8 @@ public class ComposedActionBarContributor extends MultiPageEditorActionBarContri
if(contributor != this && contributor instanceof EditorActionBarContributor)
((EditorActionBarContributor)contributor).setActiveEditor(activeEditor);
- // if(contributor != this && contributor instanceof
- // IMultiPageEditorActionBarContributor)
- // ((IMultiPageEditorActionBarContributor)contributor).setActivePage(activeEditor);
+ // if(contributor != this && contributor instanceof IMultiPageEditorActionBarContributor)
+ // ((IMultiPageEditorActionBarContributor)contributor).setActivePage(activeEditor);
}
@@ -111,11 +109,10 @@ public class ComposedActionBarContributor extends MultiPageEditorActionBarContri
// Switch the editor and activeContributor.
super.setActiveEditor(part);
// Now, propagate to the new activeContributor
- // IEditorActionBarContributor activeContributor =
- // getActiveContributor();
+ // IEditorActionBarContributor activeContributor = getActiveContributor();
//
- // if(activeContributor!=this)
- // activeContributor.setActiveEditor(part);
+ // if(activeContributor!=this)
+ // activeContributor.setActiveEditor(part);
}
/**
@@ -129,12 +126,13 @@ public class ComposedActionBarContributor extends MultiPageEditorActionBarContri
if(activeNestedEditor == null)
return this;
- //
+ //
return activeNestedEditor.getEditorSite().getActionBarContributor();
}
+
// ************************************************ //
- // Propagate method calls //
+ // Propagate method calls //
// ************************************************ //
/**
@@ -142,14 +140,13 @@ public class ComposedActionBarContributor extends MultiPageEditorActionBarContri
*
* @return the action bars
*/
- // public IActionBars getActionBars() {
- // IEditorActionBarContributor activeContributor = getActiveContributor();
- // if( activeContributor!=this && activeContributor instanceof
- // EditorActionBarContributor)
- // return
- // ((EditorActionBarContributor)getActiveContributor()).getActionBars();
- // else
- // return super.getActionBars();
- // }
+ // public IActionBars getActionBars() {
+ // IEditorActionBarContributor activeContributor = getActiveContributor();
+ // if( activeContributor!=this && activeContributor instanceof EditorActionBarContributor)
+ // return ((EditorActionBarContributor)getActiveContributor()).getActionBars();
+ // else
+ // return super.getActionBars();
+ // }
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java
index 51d294c99a0..6c366a387e4 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/IMultiPageEditorActionBarContributor.java
@@ -17,10 +17,9 @@ import org.eclipse.ui.IEditorPart;
/**
* Interface implemented by ActionBarContributor dedicated to MultiEditor.
- * ActionBarContributor that want to be advised of a page change should
- * implement this interface. Another way should be to use a Observer/Observee
- * mechanism, allowing to remove the dependancy from the editor to the
- * ActionBarContributor ?
+ * ActionBarContributor that want to be advised of a page change should implement this interface.
+ * Another way should be to use a Observer/Observee mechanism, allowing to remove the dependancy
+ * from the editor to the ActionBarContributor ?
*
* @author dumoulin
*
@@ -28,8 +27,7 @@ import org.eclipse.ui.IEditorPart;
public interface IMultiPageEditorActionBarContributor {
/**
- * Sets the active page of the the multi-page editor to be the given editor.
- * Redirect actions to the given editor if actions are not already being
+ * Sets the active page of the the multi-page editor to be the given editor. Redirect actions to the given editor if actions are not already being
* sent to it.
* * This method is called whenever the page changes. Subclasses must implement this method to redirect actions to the given editor (if not already @@ -37,9 +35,7 @@ public interface IMultiPageEditorActionBarContributor { *
* * @param activeEditor - * the new active editor, ornull
if there is no
- * active page, or if the active page does not have a
- * corresponding editor
+ * the new active editor, or null
if there is no active page, or if the active page does not have a corresponding editor
*/
public abstract void setActivePage(IEditorPart activeEditor);
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java
index ef6e754d645..3264225df18 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/actionbarcontributor/MultiPageEditorActionBarContributor.java
@@ -17,8 +17,7 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.part.EditorActionBarContributor;
/**
- * Abstract base class for managing the installation/deinstallation of global
- * actions for multi-page editors.
+ * Abstract base class for managing the installation/deinstallation of global actions for multi-page editors.
*
* Subclasses must implement setActivePage
, and may reimplement any of the following methods:
*
null
if there
- * is no selected page, or if the selected page is a control with no site.
+ * The active service locator. This value may be null
if there is no selected page, or if the selected page is a control with no
+ * site.
*/
private INestable activeServiceLocator;
@@ -80,9 +81,9 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
}
/**
- * Get the currently active IEditorPart, if any. Return null if there is no
- * active IeditorPart. Method check if the active leaf encapsulate an
- * IEditorPart. Return it if true.
+ * Get the currently active IEditorPart, if any.
+ * Return null if there is no active IeditorPart.
+ * Method check if the active leaf encapsulate an IEditorPart. Return it if true.
*
* @return The currentlyactive IEditorPart or null.
*/
@@ -91,9 +92,9 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
}
/**
- * Get IEditorPart of the specified PagePart, if any. Return null if there
- * is no IeditorPart. Method check if the leaf encapsulate an IEditorPart.
- * Return it if true.
+ * Get IEditorPart of the specified PagePart, if any.
+ * Return null if there is no IeditorPart.
+ * Method check if the leaf encapsulate an IEditorPart. Return it if true.
*
* @return The IEditorPart or null.
*/
@@ -109,7 +110,8 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
}
/**
- * Called when the active editor is changed. Perform requested operations.
+ * Called when the active editor is changed.
+ * Perform requested operations.
*
* @param oldEditor
* @param newEditor
@@ -119,9 +121,7 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
return;
}
- // System.out.println(getClass().getSimpleName() +
- // ".activeEditorChange('" + (newEditor != null ?
- // newEditor.getPageTitle() : "null") + "')");
+ // System.out.println(getClass().getSimpleName() + ".activeEditorChange('" + (newEditor != null ? newEditor.getPageTitle() : "null") + "')");
activeEditor = newEditor;
@@ -137,15 +137,15 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
propagateSelectionChanged();
activateServices();
- //
+ //
if(newEditor != null)
newEditor.setFocus();
}
/**
* Change the current selection of the outermost editor (the main editor).
- * Send a {@link SelectionChangedEvent} event to the outerProvider. The
- * event contains the current selection of the new activeEditor.
+ * Send a {@link SelectionChangedEvent} event to the outerProvider. The event contains the current selection
+ * of the new activeEditor.
*
* @param editor
* The new activeEditor.
@@ -156,8 +156,7 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
IEditorPart editorPart = getActiveIEditorPart();
// Propagate the selection change event.
- // Get the selection of the new activeEditor and send an
- // SelectionChangedEvent to the outerProvider (provider of the main
+ // Get the selection of the new activeEditor and send an SelectionChangedEvent to the outerProvider (provider of the main
// editor) with the selection.
if(editorPart != null) {
ISelectionProvider selectionProvider = editorPart.getSite().getSelectionProvider();
@@ -171,8 +170,9 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
provider.firePostSelectionChanged(event);
} else {
if(log.isLoggable(Level.WARNING)) {
- log.warning(this.getClass().getSimpleName() + " did not propogate selection for " //$NON-NLS-1$
- + editorPart.getTitle());
+ log.warning(this.getClass().getSimpleName()
+ + " did not propogate selection for " //$NON-NLS-1$
+ + editorPart.getTitle());
}
}
}
@@ -180,8 +180,8 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
}
/**
- * Activates services of the active editor: site, keybinding deactivate old
- * active site.
+ * Activates services of the active editor: site, keybinding
+ * deactivate old active site.
*/
@SuppressWarnings({ "restriction", "deprecation" })
private void activateServices() {
@@ -191,9 +191,11 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
activeServiceLocator = null;
}
+
// Get the service
final IKeyBindingService service = getOuterEditorSite().getKeyBindingService();
+
final IEditorPart editor = getActiveIEditorPart();
if(editor != null) {
@@ -216,9 +218,9 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
}
/**
- * Deactivate services: old nested site if any and keybinding service if
- * there is no active editor. Deactivate the key binding service. Deactivate
- * it only if there is no editor selected.
+ * Deactivate services: old nested site if any and keybinding service if there is no active editor.
+ * Deactivate the key binding service.
+ * Deactivate it only if there is no editor selected.
*/
@SuppressWarnings({ "restriction", "deprecation" })
private void deactivateServices(boolean immediate) {
@@ -242,8 +244,7 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
}
/**
- * Send message to the ActionBarContributor, like this it can switch the
- * active editor.
+ * Send message to the ActionBarContributor, like this it can switch the active editor.
*/
private void fireChangeEventToActionBarContributor() {
IEditorActionBarContributor contributor = getOuterEditorSite().getActionBarContributor();
@@ -267,4 +268,5 @@ public class ActiveEditorServicesSwitcher implements IActiveEditorChangedListene
return outerEditorSite;
}
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/ActivePageTracker.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/ActivePageTracker.java
index 78c6304a481..59f74099ae5 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/ActivePageTracker.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/ActivePageTracker.java
@@ -18,12 +18,11 @@ import java.util.List;
import java.util.logging.Logger;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageChangedListener;
-import org.eclipse.papyrus.infra.core.sasheditor.internal.ActivePageTracker.IActiveEditorChangedListener;
+
/**
- * Instance of this class track the active Page. When the active Page change,
- * the tracker receive an event on {@link #setActiveEditor(PagePart)}, and
- * perform following tasks:
+ * Instance of this class track the active Page.
+ * When the active Page change, the tracker receive an event on {@link #setActiveEditor(PagePart)}, and perform following tasks:
* pageChange()
whenever the selected tab changes.
+ * Creates an empty container. Creates a CTabFolder with no style bits set, and hooks a selection listener which calls pageChange()
+ * whenever the selected tab changes.
*
* @param parent
- * The composite in which the container tab folder should be
- * created; must not be null
.
+ * The composite in which the container tab folder should be created; must not be null
.
* @return a new container
*/
private CTabFolder createContainer(Composite parent) {
@@ -158,8 +159,7 @@ public class PTabFolder {
}
/**
- * Copied from org.eclipse.ui.internal.presentations.util.AbstractTabFolder.
- * attachListeners(Control, boolean)
+ * Copied from org.eclipse.ui.internal.presentations.util.AbstractTabFolder.attachListeners(Control, boolean)
*/
protected void attachListeners(CTabFolder theControl, boolean recursive) {
@@ -173,21 +173,20 @@ public class PTabFolder {
}
/**
- * Copied from org.eclipse.ui.internal.presentations.util.AbstractTabFolder.
- * detachListeners(Control, boolean)
+ * Copied from org.eclipse.ui.internal.presentations.util.AbstractTabFolder.detachListeners(Control, boolean)
*/
private void detachListeners(Control theControl) {
theControl.removeMenuDetectListener(menuDetectListener);
//
PresentationUtil.removeDragListener(theControl, dragListener);
// theControl.removeDragDetectListener(dragDetectListener);
- // theControl.removeListener(SWT.MouseUp, mouseUpListener);
+ // theControl.removeListener(SWT.MouseUp, mouseUpListener);
theControl.removeListener(SWT.Activate, activateListener);
}
/**
- * The context menu event has been fired, handle it. Actually, it is
- * forwarded to the {@link EventsManager}.
+ * The context menu event has been fired, handle it.
+ * Actually, it is forwarded to the {@link EventsManager}.
*
* @param displayPos
* @param e
@@ -199,9 +198,8 @@ public class PTabFolder {
}
/**
- * Called when drag start. From here, DragUtil.performDrag() is called,
- * which start the dragging process. DragUtil.performDrag() will contains
- * the tabFolder or the dragged tab.
+ * Called when drag start. From here, DragUtil.performDrag() is called, which start the
+ * dragging process. DragUtil.performDrag() will contains the tabFolder or the dragged tab.
*/
protected void handleDragStarted(Point displayPos, Event e) {
@@ -217,27 +215,28 @@ public class PTabFolder {
}
/**
- * Handle menu detect. TODO Connect menu staff here.
+ * Handle menu detect.
+ * TODO Connect menu staff here.
*
* @param displayPos
* @param e
*/
private void handleMenuDetect(Point displayPos, MenuDetectEvent e) {
- // if(isOnBorder(displayPos)) {
- // return;
- // }
+ // if(isOnBorder(displayPos)) {
+ // return;
+ // }
CTabItem tab = getItem(displayPos);
listenersManager.fireMenuDetectEvent(tab, e);
}
/**
- * Handle folder reselected. A folder is reselected by clicking on the
- * active tabs, on the page or on the empty tabs area. In each case a
- * PageChangeEvent is fired. When mouse click happen on the empty area, or
- * on the page, the last selected tabs is used. Used to switch the Active
- * tab when user click on already opened tabs.
+ * Handle folder reselected.
+ * A folder is reselected by clicking on the active tabs, on the page or on the empty tabs area.
+ * In each case a PageChangeEvent is fired.
+ * When mouse click happen on the empty area, or on the page, the last selected tabs is used.
+ * Used to switch the Active tab when user click on already opened tabs.
*
* @param displayPos
* @param e
@@ -255,9 +254,8 @@ public class PTabFolder {
}
/**
- * Returns true iff the given point is on the border of the folder. By
- * default, double-clicking, context menus, and drag/drop are disabled on
- * the folder's border.
+ * Returns true iff the given point is on the border of the folder. By default, double-clicking,
+ * context menus, and drag/drop are disabled on the folder's border.
*
* @param toTest
* a point (display coordinates)
@@ -304,17 +302,16 @@ public class PTabFolder {
}
/**
- * Get the rectangle bounding the item, in the parent coordinates. Utility
- * method. Can be moved somewhere else.
+ * Get the rectangle bounding the item, in the parent coordinates. Utility method. Can be moved somewhere else.
*/
public Rectangle getItemBounds(CTabItem item) {
return Geometry.toDisplay(item.getParent(), item.getBounds());
}
/**
- * Fire a page closed event. This event is fired when the close item is
- * pressed. The item is not closed yet. By default, the item is closed after
- * the event. The item is not closed if event.doit is set to false.
+ * Fire a page closed event. This event is fired when the close item is pressed. The item is not closed yet. By default, the item is closed after
+ * the event. The item is not closed if event.doit is
+ * set to false.
*
*/
protected void fireItemClosed(CTabFolderEvent event, int pageIndex) {
@@ -356,8 +353,7 @@ public class PTabFolder {
* Get the index of the draggedObject
*
* @param draggedObject
- * draggedObject should be of type CTabFolder or CTabItem (as
- * provided by handleDragStarted())
+ * draggedObject should be of type CTabFolder or CTabItem (as provided by handleDragStarted())
*/
static public int getDraggedObjectTabIndex(Object draggedObject) {
if(draggedObject instanceof CTabItem) {
@@ -389,7 +385,8 @@ public class PTabFolder {
}
/**
- * Get the event manager. The event manager can be used to listen to events.
+ * Get the event manager.
+ * The event manager can be used to listen to events.
*
* @return
*/
@@ -420,7 +417,8 @@ public class PTabFolder {
}
/**
- * Internal implementations. Implements a list of listeners.
+ * Internal implementations.
+ * Implements a list of listeners.
*
* @author dumoulin
*
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PagePart.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PagePart.java
index ffef343925b..b8a18ab5ac3 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PagePart.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PagePart.java
@@ -23,22 +23,19 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/**
- * This class represent a leaf part that is a part containing an editor or a
- * component.
+ * This class represent a leaf part that is a part containing an editor or a component.
*
* @author dumoulin
*/
public abstract class PagePart extends AbstractPart implements IPage {
- /**
- * Raw model associated to this part. We store it because the PartModel do
- * not provide it
- */
+ /** Raw model associated to this part. We store it because the PartModel do not provide it */
protected Object rawModel;
/** Parent part of this Part */
protected TabFolderPart parent;
+
/**
* Constructor.
*
@@ -50,18 +47,18 @@ public abstract class PagePart extends AbstractPart implements IPage {
this.rawModel = rawModel;
}
+
/**
* @return the parent
*/
- public TabFolderPart getParent() {
+ protected TabFolderPart getParent() {
return parent;
}
/**
- * Orphan this node. The parent is set to null, but control is left
- * unchanged. The node can be reattached with reparent(). Change garbage
- * state to {@link GarbageState.ORPHANED}. This method as no effect if the
- * Page has already been reparented.
+ * Orphan this node. The parent is set to null, but control is left unchanged.
+ * The node can be reattached with reparent(). Change garbage state to {@link GarbageState.ORPHANED}.
+ * This method as no effect if the Page has already been reparented.
*
* @see
* @return the parent
@@ -75,7 +72,8 @@ public abstract class PagePart extends AbstractPart implements IPage {
}
/**
- * Mark this Page as UNCHANGED. The PAge should be in the COLLECTED state.
+ * Mark this Page as UNCHANGED.
+ * The PAge should be in the COLLECTED state.
*
* @see
* @return the parent
@@ -100,8 +98,8 @@ public abstract class PagePart extends AbstractPart implements IPage {
abstract boolean visit(IPartVisitor visitor);
/**
- * Locates the part that intersects the given point and that have the
- * expected type. For a leaf, return the leaf if it is of the expected type.
+ * Locates the part that intersects the given point and that have the expected type.
+ * For a leaf, return the leaf if it is of the expected type.
*
* @param position
* @param expectedTileType
@@ -130,16 +128,16 @@ public abstract class PagePart extends AbstractPart implements IPage {
abstract public Control getControl();
/**
- * reparent this Part with the specified new parent. The part is marked as
- * reparented.
+ * reparent this Part with the specified new parent.
+ * The part is marked as reparented.
*
* @param parent
*/
abstract public void reparent(TabFolderPart parent);
/**
- * Add the tree of parts starting from this part. As we are a leaf, add
- * itself only.
+ * Add the tree of parts starting from this part.
+ * As we are a leaf, add itself only.
*
* @param partMap
*/
@@ -158,8 +156,9 @@ public abstract class PagePart extends AbstractPart implements IPage {
}
/**
- * Return a title for this part. This title can be used by parent to be
- * shown in tabs ... To be implemented by subclasses.
+ * Return a title for this part. This title can be used by parent to be shown
+ * in tabs ...
+ * To be implemented by subclasses.
*
* @return The title or null.
*/
@@ -169,7 +168,8 @@ public abstract class PagePart extends AbstractPart implements IPage {
/**
* Return a icon for this part. This title can be used by parent to be shown
- * in tabs ... To be implemented by subclasses.
+ * in tabs ...
+ * To be implemented by subclasses.
*
* @return The icon or null.
*/
@@ -183,10 +183,9 @@ public abstract class PagePart extends AbstractPart implements IPage {
public void refreshTab() {
getParent().refreshPageTab(this);
}
-
/**
- * Set focus on the SWT control associated to this PagePart. Used by the
- * ActivePageTracker.
+ * Set focus on the SWT control associated to this PagePart.
+ * Used by the ActivePageTracker.
*/
abstract public void setFocus();
@@ -196,8 +195,8 @@ public abstract class PagePart extends AbstractPart implements IPage {
abstract public void garbage();
/**
- * Return true if the part is associated to the specified rawModel. Return
- * false otherwise.
+ * Return true if the part is associated to the specified rawModel.
+ * Return false otherwise.
*
* @param realModel
* @return
@@ -206,4 +205,5 @@ public abstract class PagePart extends AbstractPart implements IPage {
return this.rawModel == realModel;
}
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PageVisitorWrapper.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PageVisitorWrapper.java
index 69aed4c2c5c..b694efe5659 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PageVisitorWrapper.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PageVisitorWrapper.java
@@ -6,6 +6,7 @@ package org.eclipse.papyrus.infra.core.sasheditor.internal;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IEditorPage;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPageVisitor;
+
/**
* A wrapper used to let the provided public visitor use the internal visitor to
* visit {@link ComponentPart} and {@link EditorPart}.
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PartLists.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PartLists.java
index 8c19ef3719e..af72d4eb4fa 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PartLists.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/PartLists.java
@@ -16,12 +16,12 @@ package org.eclipse.papyrus.infra.core.sasheditor.internal;
import java.util.ArrayList;
import java.util.List;
+
/**
- * This class contains lists of parts, regardless of the part parents. There are
- * two lists: one for the pane Parts and one for the Page Parts (leafs). This
- * class is used when refreshing the SashContainer: a new instance is created
- * and filled with existing parts. Then the list is carried in each pane refresh
- * method.
+ * This class contains lists of parts, regardless of the part parents.
+ * There are two lists: one for the pane Parts and one for the Page Parts (leafs).
+ * This class is used when refreshing the SashContainer: a new instance is created
+ * and filled with existing parts. Then the list is carried in each pane refresh method.
*
* @author cedric dumoulin
*/
@@ -35,8 +35,8 @@ public class PartLists {
private Listnull
.
+ */
+ public void createPartControl(Composite parent) {
+ this.container = parent;
+
+ rootPart = createRootPart();
+ // Create the tree of tile part.
+ rootPart.createPartControl(container);
+ // Create children
+ refreshTabs();
+ // Set selection
+ selectPage(lookupFirstValidPage());
+
+ // postCreatePartControl();
+ // TODO reactivate next
+ initDrag(container);
+ // activate();
+ }
+
+ /**
+ * Create the root part for the model.
+ */
+ private RootPart createRootPart() {
+ RootPart part = new RootPart(this);
+ return part;
+ }
+
+ /**
+ * Notifies this page container that the specified page has been activated. This method
+ * is called after the current tabs has been changed, either by refreshing the tabs, or by a user
+ * UI action.
+ * This method just set correctly the active page value in the Container, and fire pageChanged events if needed.
+ * It does not change the selected page in the Part.
+ *
+ * Propagate the event to activePageTracker.
+ *
+ * @param childPart
+ */
+ protected void pageChanged(PagePart childPart) {
+ activePageTracker.setActiveEditor(childPart);
+ lifeCycleEventProvider.firePageActivatedEvent(childPart);
+ }
+
+ /**
+ * Notifies this page container that a pageChanged event has been fired by one swt Control.
+ * This method is usually called after the user selects a different tab.
+ *
+ * The method record the new active folder in the ContentProvider, and calls {@link #pageChanged(PagePart)}.
+ *
+ * @param childPart
+ */
+ protected void pageChangedEvent(PagePart childPart) {
+
+ // Check if it is really a change before changing the model (which can throw change event)
+ // The folder model change is done before the tracker fires the listeners, like this
+ // listeners can check the model.
+ if(getActivePage() == childPart)
+ return;
+
+ contentProvider.setCurrentFolder(childPart.getParent().getRawModel());
+ pageChanged(childPart);
+ }
+
+ /**
+ * Set the active page. The current active page will be the specified page.
+ * Do not record the new active folder in the ContentProvider
+ *
+ * The method record the new CurrentFolder, and calls {@link #pageChanged(PagePart)}.
+ *
+ * @param childPart
+ */
+ protected void setActivePage(PagePart childPart) {
+ pageChanged(childPart);
+ }
+
+ /**
+ * A change has happen in one of the inner parts. Relay the event.
+ * This method is called by inner parts whenever the event happen in one of the part.
+ * It collects and relay the firePropertyChange(int propertyId) calls from the inner IEditor.
+ *
+ * @param propertyId
+ */
+ protected void firePropertyChange(int propertyId) {
+ // For now, we do nothing with this event.
+ }
+
+ /**
+ * Create the part for the specified newModel.
+ *
+ * @param parent
+ * The parent of the created part.
+ * @param partModel
+ * The model for which a part should be created.
+ * @return
+ */
+ protected PagePart createPagePart(TabFolderPart parent, IPageModel partModel, Object rawModel) {
+
+
+ if(partModel instanceof IEditorModel) {
+ // Check if we can use IEditorModel
+ if(multiEditorManager == null)
+ throw new IllegalArgumentException("Container can't accept IEditorModel as no IMultiEditorManager is set. Please set a IMultiEditorManager.");
+
+ return new EditorPart(parent, (IEditorModel)partModel, rawModel, multiEditorManager);
+ } else if(partModel instanceof IComponentModel) {
+ return new ComponentPart(parent, (IComponentModel)partModel, rawModel);
+ } else {
+ // Return a default part
+ }
+
+ // TODO return a default part showing an error instead.
+ throw new IllegalArgumentException("No Part found for the model '" + rawModel + "'");
+ }
+
+ /**
+ * Get the active page.
+ *
+ * @return
+ */
+ private PagePart getActivePage() {
+ return activePageTracker.getActiveEditor();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer#getActiveEditor()
+ * @return
+ *
+ */
+ public IEditorPart getActiveEditor() {
+ PagePart pagePart = getActivePage();
+ if(pagePart instanceof EditorPart)
+ return ((EditorPart)pagePart).getIEditorPart();
+ else
+ return null;
+ }
+
+ /**
+ * Get the active page public API.
+ *
+ * @return
+ */
+ public IPage getActiveSashWindowsPage() {
+ return getActivePage();
+ }
+
+ /**
+ * Get the list of visible IPages. The visible IPages are the one that have there diagram area
+ * visible.
+ *
+ * @return
+ */
+ public ListsetFocus()
method. Otherwise, this calls setFocus
on the control for the page.
+ *
+ * @param pageIndex
+ * the index of the page
+ */
+ private void setFocus(PagePart part) {
+ if(part != null)
+ part.setFocus();
+ }
+
+
+ /**
+ * Refresh the tabs.
+ * Is we are already currently refreshing, simply return.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer#refreshTabs()
+ *
+ */
+ public void refreshTabs() {
+
+ // Check if we arent already refreshing
+ if(isRefreshing.compareAndSet(false, true)) {
+ try {
+ refreshTabsInternal();
+ } finally {
+ isRefreshing.set(false);
+ }
+ } else {
+ log.warn("refresh inside refresh !");
+ }
+
+ }
+
+ /**
+ * Refresh the tab of the page, (i.e the name and icon in the page's tab).
+ *
+ * @param page The page for which the name and icon should be refreshed.
+ */
+ public void refreshPageTab(IPage page) {
+ if( page instanceof PagePart)
+ {
+ ((PagePart)page).refreshTab();
+ }
+ else
+ {
+ // TODO : lookup for the corresponding PagePart, and call refresh.
+
+ }
+ }
+ /**
+ * Real implementation of refreshTab.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer#refreshTabs()
+ *
+ */
+ private void refreshTabsInternal() {
+ // System.out.println("start synchronize2() ------------------------");
+ // showTilesStatus();
+
+ // Get the currently selected folder
+ PagePart oldActivePage = getActivePage();
+
+ // Do refresh
+ container.setRedraw(false);
+ // Create map of parts
+ // PartMapMultiPageEditor
implementation of this IWorkbenchPart
method sets focus on the active nested
- * editor, if there is one.
+ * The MultiPageEditor
implementation of this IWorkbenchPart
method sets focus on
+ * the active nested editor, if there is one.
* * Subclasses may extend or reimplement. *
@@ -357,8 +342,8 @@ public class TabFolderPart extends AbstractTabFolderPart { } /** - * Sets focus to the control for the given page. If the page has an editor, - * this calls itssetFocus()
method. Otherwise, this calls setFocus
on the control for the page.
+ * Sets focus to the control for the given page. If the page has an editor, this calls its setFocus()
method. Otherwise, this calls
+ * setFocus
on the control for the page.
*
* @param pageIndex
* the index of the page
@@ -372,9 +357,8 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Set the active page of this multi-page editor to the page that contains
- * the given editor part. This method has no effect of the given editor part
- * is not contained in this multi-page editor.
+ * Set the active page of this multi-page editor to the page that contains the given editor part. This method has no effect of the given editor
+ * part is not contained in this multi-page editor.
*
* @param editorPart
* the editor part
@@ -392,8 +376,8 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Return the part containing specified point. Normally return this part,
- * because the caller has already determine that this contain the part.
+ * Return the part containing specified point. Normally return this part, because the caller has
+ * already determine that this contain the part.
*
*/
@Override
@@ -402,8 +386,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Locates the part that intersects the given point and that have the
- * expected type
+ * Locates the part that intersects the given point and that have the expected type
*
* @param toFind
* @return
@@ -447,10 +430,9 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Get the visible PagePart (from the Container point of view). The visible
- * PagePart is the one that has its diagram area visible. From the folder
- * point of view, this is the active PagePart.
- *
+ * Get the visible PagePart (from the Container point of view).
+ * The visible PagePart is the one that has its diagram area visible.
+ * From the folder point of view, this is the active PagePart.
* @return
*/
public PagePart getVisiblePagePart() {
@@ -460,7 +442,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
return null;
}
-
+
/**
* Find the part associated to the provided control.
*
@@ -478,6 +460,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
return null;
}
+
/**
*
* @see org.eclipse.papyrus.infra.core.sasheditor.internal.AbstractPanelPart#getDropTarget(java.lang.Object,
@@ -500,8 +483,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
if(tabUnderPointer == null) {
Rectangle titleArea = pTabFolder.getTabArea();
- // If we're dragging over the title area, treat this as a drop in
- // the last
+ // If we're dragging over the title area, treat this as a drop in the last
// tab position.
if(titleArea.contains(position) && pTabFolder.getTabFolder().getItemCount() > 0) {
int dragOverIndex = pTabFolder.getTabFolder().getItemCount();
@@ -512,8 +494,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
return null;
}
- // If we are unable to compute the bounds for this tab, then
- // ignore the drop
+ // If we are unable to compute the bounds for this tab, then ignore the drop
Rectangle lastTabBounds = lastTab.getBounds();
if(lastTabBounds.isEmpty()) {
return null;
@@ -522,32 +503,24 @@ public class TabFolderPart extends AbstractTabFolderPart {
// if (dragStart >= 0) {
// dragOverIndex--;
//
- // return createDropTarget( sourcePart, lastTabBounds,
- // dragOverIndex);
- // // return new StackDropResult(lastTabBounds, new
- // Integer(dragOverIndex));
+ // return createDropTarget( sourcePart, lastTabBounds, dragOverIndex);
+ // // return new StackDropResult(lastTabBounds, new Integer(dragOverIndex));
// }
- // Make the drag-over rectangle look like a tab at the end of
- // the tab region.
- // We don't actually know how wide the tab will be when it's
- // dropped, so just
+ // Make the drag-over rectangle look like a tab at the end of the tab region.
+ // We don't actually know how wide the tab will be when it's dropped, so just
// make it 3 times wider than it is tall.
- // titleArea is in Display coordinate, lastTabBounds in parent
- // coordinate
+ // titleArea is in Display coordinate, lastTabBounds in parent coordinate
Rectangle dropRectangle = titleArea;
dropRectangle.x = dropRectangle.x + lastTabBounds.x + lastTabBounds.width;
dropRectangle.width = 3 * dropRectangle.height;
return createDropTarget(sourcePart, sourceIndex, dropRectangle, dragOverIndex);
- // return new StackDropResult(dropRectangle, new
- // Integer(dragOverIndex));
+ // return new StackDropResult(dropRectangle, new Integer(dragOverIndex));
} else {
- // If the closest side is the side with the tabs, consider this
- // a stack operation.
- // Otherwise, let the drop fall through to whatever the default
- // behavior is
+ // If the closest side is the side with the tabs, consider this a stack operation.
+ // Otherwise, let the drop fall through to whatever the default behavior is
Rectangle displayBounds = DragUtil.getDisplayBounds(pTabFolder.getControl());
int closestSide = Geometry.getClosestSide(displayBounds, position);
if(closestSide == pTabFolder.getTabFolder().getTabPosition()) {
@@ -587,8 +560,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Class implementing methods required by drop targets. Drop target use when
- * the drop occur on one of the thumbnail of the folder.
+ * Class implementing methods required by drop targets. Drop target use when the drop occur on one of the thumbnail of the folder.
*/
protected class DropTarget implements IDropTarget {
@@ -649,23 +621,20 @@ public class TabFolderPart extends AbstractTabFolderPart {
* @see org.eclipse.ui.internal.dnd.IDropTarget#getCursor()
*/
public Cursor getCursor() {
- // System.out.println(TabFolderPart.this.getClass().getSimpleName()
- // + ".getCursor()-" + count++);
+ // System.out.println(TabFolderPart.this.getClass().getSimpleName() + ".getCursor()-" + count++);
return DragCursors.getCursor(DragCursors.positionToDragCursor(cursor));
}
public Rectangle getSnapRectangle() {
- // System.out.println(TabFolderPart.this.getClass().getSimpleName()
- // + ".getSnapRectangle()-" + count);
+ // System.out.println(TabFolderPart.this.getClass().getSimpleName() + ".getSnapRectangle()-" + count);
return snapRectangle;
}
}
/**
- * Orphan this node. The parent is set to null, but control is left
- * unchanged. The node can be reattached with reparent().
+ * Orphan this node. The parent is set to null, but control is left unchanged. The node can be reattached with reparent().
*
* @see
* @return the parent
@@ -711,8 +680,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Return true if the Part is for the specified real model. Return false
- * otherwise.
+ * Return true if the Part is for the specified real model. Return false otherwise.
*
* @param realModel
* The raw model to check
@@ -727,30 +695,29 @@ public class TabFolderPart extends AbstractTabFolderPart {
*
* @return
*/
- public Object getRawModel() {
+ protected Object getRawModel() {
return rawModel;
}
/**
* Refresh the tab of this page (I.e the name and icon in the tab).
*
- * @param page
- * The page to be refreshed
+ * @param page The page to be refreshed
*/
- public void refreshPageTab(PagePart page) {
+ public void refreshPageTab( PagePart page) {
TabItemPart itemPart = currentTabItems.getByPagePart(page);
- if(itemPart == null)
+ if(itemPart==null)
return;
-
+
itemPart.refreshTabDecorations();
}
-
+
/**
- * Synchronize the TabFolder with the models. The Tabs order is fixed and
- * can't be moved. So, we move the associated ITilepart if needed. For each
- * existing Tab, compare its model and the requested model. Synchronize if
- * necessary. If their is more new model, add new Tab If their is less
- * newModel, remove unused Tabs.
+ * Synchronize the TabFolder with the models.
+ * The Tabs order is fixed and can't be moved. So, we move the associated ITilepart if needed.
+ * For each existing Tab, compare its model and the requested model. Synchronize if necessary.
+ * If their is more new model, add new Tab
+ * If their is less newModel, remove unused Tabs.
*
* @param partLists
*/
@@ -812,24 +779,23 @@ public class TabFolderPart extends AbstractTabFolderPart {
activePageIndex = currentTabItems.size() - 1;
}
+
folder.setRedraw(true);
- // folder.setSelection(activePageIndex);
+ // folder.setSelection(activePageIndex);
folder.redraw();
- if(activePageIndex >= 0 && activePageIndex < folder.getItemCount()) {
- // System.err.println("setActivePage(" + activePageIndex + ") : " +
- // this);
+ if(activePageIndex >= 0) {
+ // System.err.println("setActivePage(" + activePageIndex + ") : " + this);
// Set the activeTab has visible.
// Do it here because otherwise the active tab could be not visible.
- // This come from an undefined bug setting the tab.isVisible(false)
- // in some case.
+ // This come from an undefined bug setting the tab.isVisible(false) in some case.
folder.getItem(activePageIndex).getControl().setVisible(true);
setActivePage(activePageIndex);
} else {
// Check if there is item in the CTabFolder.
// If true, we have a trouble
if(getTabFolder().getItemCount() > 0) {
- // System.err.println("Active page not set while synchronizing !");
+ // System.err.println("Active page not set while synchronizing !");
// We have items, but none is selected.
// Select the first one.
if(getTabFolder().getSelectionIndex() < 0) {
@@ -837,14 +803,14 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
}
}
- // folder.update();
- // folder.showSelection();
+ // folder.update();
+ // folder.showSelection();
}
/**
- * Remove the specified tabItem. Also call appropriate remove() method on
- * the tabItem.
+ * Remove the specified tabItem.
+ * Also call appropriate remove() method on the tabItem.
*
* @param curTab
*/
@@ -854,10 +820,9 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Create a new TabItem associated to the part corresponding to the
- * specified newModel. The TabItem is created at the specified index. The
- * associated parts is searched in the existingParts or created if none is
- * found.
+ * Create a new TabItem associated to the part corresponding to the specified newModel.
+ * The TabItem is created at the specified index.
+ * The associated parts is searched in the existingParts or created if none is found.
*
* @param existingParts
* List of existing parts.
@@ -877,44 +842,42 @@ public class TabFolderPart extends AbstractTabFolderPart {
// No part found, create one
modelPart = createChildPart(newModel);
if(modelPart != null) {
- existingParts.addCreatedPage(modelPart);
- // Attach it to the tabItem
- newTab = new TabItemPart(this, modelPart, index);
- }
+ existingParts.addCreatedPage(modelPart);
+ // Attach it to the tabItem
+ newTab = new TabItemPart(this, modelPart, index);
+ }
}
// Add to the list of items.
if(newTab != null) {
- currentTabItems.add(index, newTab);
+ currentTabItems.add(index, newTab);
}
}
- // /**
- // * Create a new TabItem and associated part corresponding to the specified
- // newModel.
- // * The TabItem is created at the specified index.
- // * The associated parts is created.
- // *
- // * @param existingParts List of existing parts.
- // * @param newModel
- // * @param index
- // * @param i
- // */
- // private void createTabItem(Object newModel, int index) {
- // TabItemPart newTab;
+ // /**
+ // * Create a new TabItem and associated part corresponding to the specified newModel.
+ // * The TabItem is created at the specified index.
+ // * The associated parts is created.
+ // *
+ // * @param existingParts List of existing parts.
+ // * @param newModel
+ // * @param index
+ // * @param i
+ // */
+ // private void createTabItem(Object newModel, int index) {
+ // TabItemPart newTab;
//
- // PagePart modelPart = createChildPart( newModel );
- // // Attach it to the tabItem
- // newTab = new TabItemPart(this, modelPart, index);
+ // PagePart modelPart = createChildPart( newModel );
+ // // Attach it to the tabItem
+ // newTab = new TabItemPart(this, modelPart, index);
//
- // // Add to the list of items.
- // currentTabItems.add(index, newTab);
- // }
+ // // Add to the list of items.
+ // currentTabItems.add(index, newTab);
+ // }
/**
- * Instruct the specified tabItem to use the new model. Check if a part
- * already exist for the model and use it if any. Otherwise create a new
- * Part.
+ * Instruct the specified tabItem to use the new model. Check if a part already exist for the model
+ * and use it if any. Otherwise create a new Part.
*
* @param curTab
* @param existingParts
@@ -936,10 +899,10 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Factory method to create a new Part for the specified newModel. The
- * method should always return a valid Part. In case of error while creating
- * the requested part, the method should return a default part, maybe
- * showing the encountered error. The control for the child is created.
+ * Factory method to create a new Part for the specified newModel.
+ * The method should always return a valid Part. In case of error while creating the requested part,
+ * the method should return a default part, maybe showing the encountered error.
+ * The control for the child is created.
*
* @param newModel
* @return The new part
@@ -950,20 +913,19 @@ public class TabFolderPart extends AbstractTabFolderPart {
IPageModel partModel = getPartModel().createChildSashModel(newModel);
if(partModel != null) {
- // Delegate part creation to the container. This allow the container to
- // provide appropriate
- // objects not available from the part.
- PagePart newPart = getSashWindowContainer().createPagePart(this, partModel, newModel);
- // Create control.
- // Fire events before and after
- getSashWindowContainer().getLifeCycleEventProvider().firePageAboutToBeOpenedEvent(newPart);
- newPart.createPartControl(getControl());
- getSashWindowContainer().getLifeCycleEventProvider().firePageOpenedEvent(newPart);
-
- return newPart;
- }
-
- return null;
+ // Delegate part creation to the container. This allow the container to provide appropriate
+ // objects not available from the part.
+ PagePart newPart = getSashWindowContainer().createPagePart(this, partModel, newModel);
+ // Create control.
+ // Fire events before and after
+ getSashWindowContainer().getLifeCycleEventProvider().firePageAboutToBeOpenedEvent(newPart);
+ newPart.createPartControl(getControl());
+ getSashWindowContainer().getLifeCycleEventProvider().firePageOpenedEvent(newPart);
+
+ return newPart;
+ }
+ // Use exception ?
+ return null;
}
/**
@@ -1004,20 +966,20 @@ public class TabFolderPart extends AbstractTabFolderPart {
System.out.println();
//
- // System.out.printf("tabs.ctrl :" );
- // for( TabItemPart tab : currentModels)
- // {
- // System.out.printf( "%10s |", tab.childPart.getControl());
- // }
- // System.out.println();
-
- //
- // System.out.printf("tab.editor:" );
- // for( TabItemPart tab : currentModels)
- // {
- // System.out.printf( "%10s |", tab.childPart.getIEditorPart());
- // }
- // System.out.println();
+ // System.out.printf("tabs.ctrl :" );
+ // for( TabItemPart tab : currentModels)
+ // {
+ // System.out.printf( "%10s |", tab.childPart.getControl());
+ // }
+ // System.out.println();
+
+ //
+ // System.out.printf("tab.editor:" );
+ // for( TabItemPart tab : currentModels)
+ // {
+ // System.out.printf( "%10s |", tab.childPart.getIEditorPart());
+ // }
+ // System.out.println();
//
System.out.printf("tabs %2d :", currentTabItems.size());
@@ -1032,19 +994,20 @@ public class TabFolderPart extends AbstractTabFolderPart {
* Show tile status.
*/
protected void showStatus() {
- // System.out.println( "tabfolder[" + currentModels.size() + "]:"
- // + ", disposed=" + getCTabFolder().isDisposed()
- // + ", visible=" + getCTabFolder().isVisible()
- // + ", garbState=" + garbageState
- // + ", " + this);
+ // System.out.println( "tabfolder[" + currentModels.size() + "]:"
+ // + ", disposed=" + getCTabFolder().isDisposed()
+ // + ", visible=" + getCTabFolder().isVisible()
+ // + ", garbState=" + garbageState
+ // + ", " + this);
CTabFolder ctrl = getTabFolder();
- System.out.printf("tabfolder[%2d]: disposed=%-5b, visible=%-5b, garbState=%-10s, %s\n", currentTabItems.size(), ctrl.isDisposed(), (ctrl.isDisposed() ? false : getTabFolder().isVisible()), garbageState, this);
+ System.out.printf("tabfolder[%2d]: disposed=%-5b, visible=%-5b, garbState=%-10s, %s\n"
+ , currentTabItems.size(), ctrl.isDisposed(), (ctrl.isDisposed() ? false : getTabFolder().isVisible()), garbageState, this);
}
/**
- * Accept the provided visitor. Call the corresponding accept method in the
- * visitor.
+ * Accept the provided visitor.
+ * Call the corresponding accept method in the visitor.
*
* @param visitor
* @return
@@ -1068,8 +1031,10 @@ public class TabFolderPart extends AbstractTabFolderPart {
return true;
}
+
/**
- * Collection of tabpart. Add miscelenaous methods.
+ * Collection of tabpart.
+ * Add miscelenaous methods.
*
* @author dumoulin
*
@@ -1088,10 +1053,10 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Returns the index of the first occurrence of the specified element in
- * this list, or -1 if this list does not contain the element. More
- * formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) , or -1 if
- * there is no such index.
+ * Returns the index of the first occurrence of the specified element
+ * in this list, or -1 if this list does not contain the element.
+ * More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))),
+ * or -1 if there is no such index.
*/
public int indexOfModel(Object o) {
if(o == null) {
@@ -1106,6 +1071,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
return -1;
}
+
/**
* Get the TabPart by its model.
*
@@ -1129,9 +1095,10 @@ public class TabFolderPart extends AbstractTabFolderPart {
}
/**
- * Track the mouse for flying over the tabs and show tooltip. Show the
- * tooltip when the mouse stop over a tab. Disable the tooltip if mouse is
- * clicked. Reenable the tooltip when exiting the tab.
+ * Track the mouse for flying over the tabs and show tooltip.
+ * Show the tooltip when the mouse stop over a tab.
+ * Disable the tooltip if mouse is clicked.
+ * Reenable the tooltip when exiting the tab.
*
* @author dumoulin
*
@@ -1152,32 +1119,33 @@ public class TabFolderPart extends AbstractTabFolderPart {
private int count = 0;
public void mouseEnter(MouseEvent e) {
- // System.out.println("MouseEnter()" + count++);
+ // System.out.println("MouseEnter()" + count++);
}
public void mouseExit(MouseEvent e) {
- // System.out.println("MouseExit()" + count++);
+ // System.out.println("MouseExit()" + count++);
toolTipManager.closeToolTip();
}
public void mouseHover(MouseEvent e) {
CTabFolder folder = getTabFolder();
- // Point pt = folder.toDisplay(e.x, e.y);
+ // Point pt = folder.toDisplay(e.x, e.y);
Point pt = new Point(e.x, e.y);
CTabItem item = folder.getItem(pt);
int index = pTabFolder.getItemIndex(pt);
- if(index == -1) {
+ if(index == -1)
+ {
toolTipManager.closeToolTip();
return;
}
PagePart part = currentTabItems.get(index).getChildPart();
- // System.out.println("MouseHover(" + e.widget
- // + ", part=" + part.getPartTitle()
- // + ", item=" + item
- // + ") - " + count++);
- // TODO move it away
+// System.out.println("MouseHover(" + e.widget
+// + ", part=" + part.getPageTitle()
+// + ", item=" + item
+// + ") - " + count++);
+ // TODO move it away
//toolTipManager.showToolTip(item.getBounds(), part.getControl(), pt);
toolTipManager.showToolTip(part, item.getBounds(), pt);
}
@@ -1186,7 +1154,8 @@ public class TabFolderPart extends AbstractTabFolderPart {
};
/**
- * Listener on mouse clicked. Used to disable the current tooltip.
+ * Listener on mouse clicked.
+ * Used to disable the current tooltip.
*/
private Listener mouseClickedListener = new Listener() {
@@ -1195,7 +1164,7 @@ public class TabFolderPart extends AbstractTabFolderPart {
public void handleEvent(Event event) {
switch(event.type) {
case SWT.MouseUp:
- // System.out.println("MouseUp()" + count++);
+// System.out.println("MouseUp()" + count++);
toolTipManager.disableToolTip();
break;
}
@@ -1203,7 +1172,8 @@ public class TabFolderPart extends AbstractTabFolderPart {
};
/**
- * Build a tracker for the specified control. Constructor.
+ * Build a tracker for the specified control.
+ * Constructor.
*
* @param control
*/
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/TabItemPart.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/TabItemPart.java
index 89dc1543ff1..580a6b4d085 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/TabItemPart.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/TabItemPart.java
@@ -22,9 +22,9 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
/**
- * A controller associated to a tabitem in a tabfolder. This controller contains
- * a reference to a PagePart. This class is used exclusively by the
- * TabFolderPart. It should be not used from elsewhere.
+ * A controller associated to a tabitem in a tabfolder. This controller contains a reference to
+ * a PagePart.
+ * This class is used exclusively by the TabFolderPart. It should be not used from elsewhere.
*
* @author dumoulin
*
@@ -34,11 +34,10 @@ public class TabItemPart {
/**
* The associated model TODO : change the type
*/
- // protected Object model;
+ // protected Object model;
/**
- * The child associated to this tabitem. The child is rendered by the
- * tabitem.
+ * The child associated to this tabitem. The child is rendered by the tabitem.
*/
protected PagePart childPart;
@@ -49,8 +48,8 @@ public class TabItemPart {
protected TabFolderPart parent;
/**
- * The SWT item associated to this part. This item contains the control of
- * the associated editor.
+ * The SWT item associated to this part. This item contains the control of the
+ * associated editor.
*/
protected CTabItem control;
@@ -58,7 +57,8 @@ public class TabItemPart {
protected GarbageState garbageState;
/**
- * Constructor. Create a TabItem for the provided modelPart.
+ * Constructor.
+ * Create a TabItem for the provided modelPart.
*
* @param tabFolderPart
* @param modelPart
@@ -96,8 +96,7 @@ public class TabItemPart {
}
/**
- * Reset this TabItem to use the new part. Reparent the new part and orphan
- * the old part.
+ * Reset this TabItem to use the new part. Reparent the new part and orphan the old part.
*
* @param modelPart
*/
@@ -132,8 +131,10 @@ public class TabItemPart {
}
/**
- * Remove the TabPart. Dispose the associated SWT CTabItem. (TODO Remove
- * from the parent list.) Orphan the associated ITilePart
+ * Remove the TabPart.
+ * Dispose the associated SWT CTabItem.
+ * (TODO Remove from the parent list.)
+ * Orphan the associated ITilePart
*
* @see
* @return the parent
@@ -186,8 +187,8 @@ public class TabItemPart {
}
/**
- * Dispose the associated control. Only dispose this tabitem, not the
- * childpart.
+ * Dispose the associated control.
+ * Only dispose this tabitem, not the childpart.
*/
public void dispose() {
Control itemControl = control.getControl();
@@ -232,23 +233,23 @@ public class TabItemPart {
}
/**
- * Locates the part that intersects the given point and that have the
- * expected type
+ * Locates the part that intersects the given point and that have the expected type
*
* @param position
* @return
*/
public AbstractPart findPartAt(Point position, Class> expectedTileType) {
- // if(expectedTileType == this.getClass())
- // return this;
+ // if(expectedTileType == this.getClass())
+ // return this;
return childPart.findPartAt(position, expectedTileType);
}
+
/**
- * Accept the provided visitor. Call the corresponding accept method in the
- * visitor.
+ * Accept the provided visitor.
+ * Call the corresponding accept method in the visitor.
*
* @param visitor
* @return
@@ -276,4 +277,5 @@ public class TabItemPart {
return rawModel.equals(getChildPart().getRawModel());
}
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java
index 293021bd59a..4951e15e8de 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/AbstractTabFolderPart.java
@@ -18,9 +18,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
/**
- * Copy of org.eclipse.ui.part.MultiPageEditorPart. Change if to be suitable has
- * a sash leaf. A multi-page editor is an editor with multiple pages, each of
- * which may contain an editor or an arbitrary SWT control.
+ * Copy of org.eclipse.ui.part.MultiPageEditorPart. Change if to be suitable has a sash leaf. A multi-page editor is an editor with multiple pages,
+ * each of which may contain an editor or an arbitrary
+ * SWT control.
* * This class is intented to separate folder stuff into 2 classes. Subclasses must implement the following methods: *
null
if
- // there is no selected page, or if the selected page is a control with no
- // site.
- // */
- // private INestable activeServiceLocator;
+ // /**
+ // * The active service locator. This value may be null
if there is no selected page, or if the selected page is a control with no site.
+ // */
+ // private INestable activeServiceLocator;
//
//
- // private IServiceLocator pageContainerSite;
+ // private IServiceLocator pageContainerSite;
/**
* Creates an empty multi-page editor with no pages.
@@ -76,8 +73,8 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
}
/**
- * The MultiPageEditor
implementation of this IWorkbenchPart
method creates the control for the multi-page
- * editor by calling createContainer
, then createPages
. Subclasses should implement createPages
rather than
+ * The MultiPageEditor
implementation of this IWorkbenchPart
method creates the control for the multi-page editor by
+ * calling createContainer
, then createPages
. Subclasses should implement createPages
rather than
* overriding this method.
*
* @param parent
@@ -94,17 +91,16 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
*
* @return the active nested editor, or null
if none
*/
- // public IEditorPart getActiveEditor() {
- // int index = getActivePage();
- // if (index != -1) {
- // return getEditor(index);
- // }
- // return null;
- // }
+ // public IEditorPart getActiveEditor() {
+ // int index = getActivePage();
+ // if (index != -1) {
+ // return getEditor(index);
+ // }
+ // return null;
+ // }
/**
- * Returns the index of the currently active page of this folder, or -1 if
- * there is no active page.
+ * Returns the index of the currently active page of this folder, or -1 if there is no active page.
* * Subclasses should not override this method *
@@ -120,35 +116,31 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart { } /** - * Returns the control for the given page index, ornull
if no
- * control has been set for the page. The page index must be valid.
+ * Returns the control for the given page index, or null
if no control has been set for the page. The page index must be valid.
* * Subclasses should not override this method *
* * @param pageIndex * the index of the page - * @return the control for the specified page, ornull
if none
- * has been set
+ * @return the control for the specified page, or null
if none has been set
*/
protected Control getControl(int pageIndex) {
return getItem(pageIndex).getControl();
}
/**
- * Returns the editor for the given page index. The page index must be
- * valid.
+ * Returns the editor for the given page index. The page index must be valid.
*
* @param pageIndex
* the index of the page
- * @return the editor for the specified page, or null
if the
- * specified page was not created with addPage(IEditorPart,IEditorInput)
+ * @return the editor for the specified page, or null
if the specified page was not created with
+ * addPage(IEditorPart,IEditorInput)
*/
- // abstract protected IEditorPart getEditor(int pageIndex);
+ // abstract protected IEditorPart getEditor(int pageIndex);
/**
- * Returns the service locator for the given page index. This method can be
- * used to create service locators for pages that are just controls. The
+ * Returns the service locator for the given page index. This method can be used to create service locators for pages that are just controls. The
* page index must be valid.
*
* This will return the editor site service locator for an editor, and create one for a page that is just a control.
@@ -156,20 +148,20 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
*
* @param pageIndex
* the index of the page
- * @return the editor for the specified page, or null
if the
- * specified page was not created with addPage(IEditorPart,IEditorInput)
+ * @return the editor for the specified page, or null
if the specified page was not created with
+ * addPage(IEditorPart,IEditorInput)
* @since 3.4
*/
- // protected final IServiceLocator getPageSite(int pageIndex) {
- // if (pageIndex == PAGE_CONTAINER_SITE) {
- // return getPageContainerSite();
- // }
+ // protected final IServiceLocator getPageSite(int pageIndex) {
+ // if (pageIndex == PAGE_CONTAINER_SITE) {
+ // return getPageContainerSite();
+ // }
//
- // /**
- // * Return the site associated to the editor.
- // */
- // return getEditor(pageIndex).getSite();
- // }
+ // /**
+ // * Return the site associated to the editor.
+ // */
+ // return getEditor(pageIndex).getSite();
+ // }
/**
* @return A site that can be used with a header.
@@ -178,27 +170,24 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
* @see #PAGE_CONTAINER_SITE
* @see #getPageSite(int)
*/
- // private IServiceLocator getPageContainerSite() {
- // if (pageContainerSite == null) {
- // IServiceLocatorCreator slc = (IServiceLocatorCreator)
- // getSite().getService(IServiceLocatorCreator.class);
- // pageContainerSite = slc.createServiceLocator(getSite(), null, new
- // IDisposable() {
+ // private IServiceLocator getPageContainerSite() {
+ // if (pageContainerSite == null) {
+ // IServiceLocatorCreator slc = (IServiceLocatorCreator) getSite().getService(IServiceLocatorCreator.class);
+ // pageContainerSite = slc.createServiceLocator(getSite(), null, new IDisposable() {
//
- // public void dispose() {
- // final Control control = ((PartSite) getSite()).getPane().getControl();
- // if (control != null && !control.isDisposed()) {
- // ((PartSite) getSite()).getPane().doHide();
- // }
- // }
- // });
- // }
- // return pageContainerSite;
- // }
+ // public void dispose() {
+ // final Control control = ((PartSite) getSite()).getPane().getControl();
+ // if (control != null && !control.isDisposed()) {
+ // ((PartSite) getSite()).getPane().doHide();
+ // }
+ // }
+ // });
+ // }
+ // return pageContainerSite;
+ // }
/**
- * Returns the tab item for the given page index (page index is 0-based).
- * The page index must be valid.
+ * Returns the tab item for the given page index (page index is 0-based). The page index must be valid.
*
* @param pageIndex
* the index of the page
@@ -230,8 +219,8 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
protected abstract CTabFolder getTabFolder();
/**
- * Notifies this multi-page editor that the page with the given id has been
- * activated. This method is called when the user selects a different tab.
+ * Notifies this multi-page editor that the page with the given id has been activated. This method is called when the user selects a different
+ * tab.
*
* The MultiPageEditorPart
implementation of this method sets focus to the new page, and notifies the action bar contributor (if
* there is one). This checks whether the action bar contributor is an instance of MultiPageEditorActionBarContributor
, and, if so,
@@ -245,57 +234,48 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
* the index of the activated page
*/
protected void pageChange(int newPageIndex) {
- // System.out.println(this.getClass().getSimpleName() + "pageChange()");
- // deactivateSite(false, false);
+ // System.out.println(this.getClass().getSimpleName() + "pageChange()");
+ // deactivateSite(false, false);
//
- // IPartService partService = (IPartService)
- // getSite().getService(IPartService.class);
- // if (partService.getActivePart() == this) {
- // setFocus(newPageIndex);
- // }
+ // IPartService partService = (IPartService) getSite().getService(IPartService.class);
+ // if (partService.getActivePart() == this) {
+ // setFocus(newPageIndex);
+ // }
//
- // IEditorPart activeEditor = getEditor(newPageIndex);
+ // IEditorPart activeEditor = getEditor(newPageIndex);
//
- // IEditorActionBarContributor contributor =
- // getEditorSite().getActionBarContributor();
- // if (contributor != null && contributor instanceof
- // MultiPageEditorActionBarContributor) {
- // ((MultiPageEditorActionBarContributor)
- // contributor).setActivePage(activeEditor);
- // }
+ // IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
+ // if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) {
+ // ((MultiPageEditorActionBarContributor) contributor).setActivePage(activeEditor);
+ // }
//
- // if (activeEditor != null) {
- // ISelectionProvider selectionProvider =
- // activeEditor.getSite().getSelectionProvider();
- // if (selectionProvider != null) {
- // ISelectionProvider outerProvider = getSite().getSelectionProvider();
- // if (outerProvider instanceof MultiPageSelectionProvider) {
- // SelectionChangedEvent event = new
- // SelectionChangedEvent(selectionProvider,
- // selectionProvider.getSelection());
+ // if (activeEditor != null) {
+ // ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
+ // if (selectionProvider != null) {
+ // ISelectionProvider outerProvider = getSite().getSelectionProvider();
+ // if (outerProvider instanceof MultiPageSelectionProvider) {
+ // SelectionChangedEvent event = new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection());
//
- // MultiPageSelectionProvider provider = (MultiPageSelectionProvider)
- // outerProvider;
- // provider.fireSelectionChanged(event);
- // provider.firePostSelectionChanged(event);
- // } else {
- // if (Policy.DEBUG_MPE) {
+ // MultiPageSelectionProvider provider = (MultiPageSelectionProvider) outerProvider;
+ // provider.fireSelectionChanged(event);
+ // provider.firePostSelectionChanged(event);
+ // } else {
+ // if (Policy.DEBUG_MPE) {
// Tracing.printTrace(TRACING_COMPONENT, "MultiPageEditorPart " + getTitle() //$NON-NLS-1$
// + " did not propogate selection for " //$NON-NLS-1$
- // + activeEditor.getTitle());
- // }
- // }
- // }
- // }
+ // + activeEditor.getTitle());
+ // }
+ // }
+ // }
+ // }
//
- // activateSite();
+ // activateSite();
}
/**
- * This method can be used by implementors of {@link AbstractTabFolderPart#createPageContainer(Composite)} to
- * deactivate the active inner editor services while their header has focus.
- * A deactivateSite() must have a matching call to activateSite() when
- * appropriate.
+ * This method can be used by implementors of {@link AbstractTabFolderPart#createPageContainer(Composite)} to deactivate the active inner editor
+ * services while their header has focus. A
+ * deactivateSite() must have a matching call to activateSite() when appropriate.
*
* An new inner editor will have its site activated on a {@link AbstractTabFolderPart#pageChange(int)}. *
@@ -313,40 +293,38 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart { * @see #getPageSite(int) * @see #PAGE_CONTAINER_SITE */ - // protected final void deactivateSite(boolean immediate, boolean - // containerSiteActive) { - // // Deactivate the nested services from the last active service locator. - // if (activeServiceLocator != null) { - // activeServiceLocator.deactivate(); - // activeServiceLocator = null; - // } + // protected final void deactivateSite(boolean immediate, boolean containerSiteActive) { + // // Deactivate the nested services from the last active service locator. + // if (activeServiceLocator != null) { + // activeServiceLocator.deactivate(); + // activeServiceLocator = null; + // } // - // final int pageIndex = getActivePage(); - // final IKeyBindingService service = getSite().getKeyBindingService(); - // if (pageIndex < 0 || pageIndex >= getPageCount() || immediate) { - // // There is no selected page, so deactivate the active service. - // if (service instanceof INestableKeyBindingService) { - // final INestableKeyBindingService nestableService = - // (INestableKeyBindingService) service; - // nestableService.activateKeyBindingService(null); - // } else { - // WorkbenchPlugin + // final int pageIndex = getActivePage(); + // final IKeyBindingService service = getSite().getKeyBindingService(); + // if (pageIndex < 0 || pageIndex >= getPageCount() || immediate) { + // // There is no selected page, so deactivate the active service. + // if (service instanceof INestableKeyBindingService) { + // final INestableKeyBindingService nestableService = (INestableKeyBindingService) service; + // nestableService.activateKeyBindingService(null); + // } else { + // WorkbenchPlugin // .log("MultiPageEditorPart.deactivateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$ - // } - // } + // } + // } // - // if (containerSiteActive) { - // IServiceLocator containerSite = getPageContainerSite(); - // if (containerSite instanceof INestable) { - // activeServiceLocator = (INestable) containerSite; - // activeServiceLocator.activate(); - // } - // } - // } + // if (containerSiteActive) { + // IServiceLocator containerSite = getPageContainerSite(); + // if (containerSite instanceof INestable) { + // activeServiceLocator = (INestable) containerSite; + // activeServiceLocator.activate(); + // } + // } + // } /** - * This method can be used by implementors of {@link #createPageContainer(Composite)} to activate the active inner - * editor services when their header loses focus. + * This method can be used by implementors of {@link #createPageContainer(Composite)} to activate the active inner editor services when their + * header loses focus. ** An new inner editor will have its site activated on a {@link #pageChange(int)}. *
@@ -359,76 +337,74 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart { * @see #createPageContainer(Composite) * @see #getPageSite(int) */ - // protected final void activateSite() { - // if (activeServiceLocator != null) { - // activeServiceLocator.deactivate(); - // activeServiceLocator = null; - // } + // protected final void activateSite() { + // if (activeServiceLocator != null) { + // activeServiceLocator.deactivate(); + // activeServiceLocator = null; + // } // - // final IKeyBindingService service = getSite().getKeyBindingService(); - // final int pageIndex = getActivePage(); - // final IEditorPart editor = getEditor(pageIndex); + // final IKeyBindingService service = getSite().getKeyBindingService(); + // final int pageIndex = getActivePage(); + // final IEditorPart editor = getEditor(pageIndex); // - // if (editor != null) { - // // active the service for this inner editor - // if (service instanceof INestableKeyBindingService) { - // final INestableKeyBindingService nestableService = - // (INestableKeyBindingService) service; - // nestableService.activateKeyBindingService(editor.getEditorSite()); + // if (editor != null) { + // // active the service for this inner editor + // if (service instanceof INestableKeyBindingService) { + // final INestableKeyBindingService nestableService = (INestableKeyBindingService) service; + // nestableService.activateKeyBindingService(editor.getEditorSite()); // - // } else { - // WorkbenchPlugin + // } else { + // WorkbenchPlugin // .log("MultiPageEditorPart.activateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$ - // } - // // Activate the services for the new service locator. - // final IServiceLocator serviceLocator = editor.getEditorSite(); - // if (serviceLocator instanceof INestable) { - // activeServiceLocator = (INestable) serviceLocator; - // activeServiceLocator.activate(); - // } + // } + // // Activate the services for the new service locator. + // final IServiceLocator serviceLocator = editor.getEditorSite(); + // if (serviceLocator instanceof INestable) { + // activeServiceLocator = (INestable) serviceLocator; + // activeServiceLocator.activate(); + // } // - // } else { - // Item item = getItem(pageIndex); + // } else { + // Item item = getItem(pageIndex); // - // // There is no selected editor, so deactivate the active service. - // if (service instanceof INestableKeyBindingService) { - // final INestableKeyBindingService nestableService = - // (INestableKeyBindingService) service; - // nestableService.activateKeyBindingService(null); - // } else { - // WorkbenchPlugin + // // There is no selected editor, so deactivate the active service. + // if (service instanceof INestableKeyBindingService) { + // final INestableKeyBindingService nestableService = (INestableKeyBindingService) service; + // nestableService.activateKeyBindingService(null); + // } else { + // WorkbenchPlugin // .log("MultiPageEditorPart.activateSite() Parent key binding service was not an instance of INestableKeyBindingService. It was an instance of " + service.getClass().getName() + " instead."); //$NON-NLS-1$ //$NON-NLS-2$ - // } + // } // - // if (item.getData() instanceof INestable) { - // activeServiceLocator = (INestable) item.getData(); - // activeServiceLocator.activate(); - // } - // } - // } + // if (item.getData() instanceof INestable) { + // activeServiceLocator = (INestable) item.getData(); + // activeServiceLocator.activate(); + // } + // } + // } - // /** - // * Disposes the given part and its site. - // * - // * @param part - // * The part to dispose; must not benull
.
- // */
- // private void disposePart(final IWorkbenchPart part) {
- // SafeRunner.run(new ISafeRunnable() {
+ // /**
+ // * Disposes the given part and its site.
+ // *
+ // * @param part
+ // * The part to dispose; must not be null
.
+ // */
+ // private void disposePart(final IWorkbenchPart part) {
+ // SafeRunner.run(new ISafeRunnable() {
//
- // public void run() {
- // IWorkbenchPartSite partSite = part.getSite();
- // part.dispose();
- // if (partSite instanceof MultiPageEditorSite) {
- // ((MultiPageEditorSite) partSite).dispose();
- // }
- // }
+ // public void run() {
+ // IWorkbenchPartSite partSite = part.getSite();
+ // part.dispose();
+ // if (partSite instanceof MultiPageEditorSite) {
+ // ((MultiPageEditorSite) partSite).dispose();
+ // }
+ // }
//
- // public void handleException(Throwable e) {
- // // Exception has already being logged by Core. Do nothing.
- // }
- // });
- // }
+ // public void handleException(Throwable e) {
+ // // Exception has already being logged by Core. Do nothing.
+ // }
+ // });
+ // }
/**
* Sets the currently active page for this folder.
@@ -437,7 +413,7 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
* the index of the page to be activated; the index must be valid
*/
public void setActivePage(int pageIndex) {
- // Assert.isTrue(pageIndex >= 0 && pageIndex < getPageCount());
+ // Assert.isTrue(pageIndex >= 0 && pageIndex < getPageCount());
if(!isValidPageIndex(pageIndex))
return;
@@ -446,8 +422,9 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
}
/**
- * Return true if the specified index is valid. The index should be between
- * 0 and pageCount. If there is no page, return false.
+ * Return true if the specified index is valid.
+ * The index should be between 0 and pageCount.
+ * If there is no page, return false.
*
* @param pageIndex
* @return
@@ -463,39 +440,40 @@ public abstract class AbstractTabFolderPart extends AbstractPanelPart {
* @param pageIndex
* the index of the page
* @param control
- * the control for the specified page, or null
to
- * clear the control
+ * the control for the specified page, or null
to clear the control
*/
protected void setControl(int pageIndex, Control control) {
getItem(pageIndex).setControl(control);
}
+
/* *************************************** */
/* Added method. */
/* *************************************** */
- // /**
- // * Title of this TilePart ? Needed by a trace message.
- // */
- // protected String getTitle() {
- // return getClass().toString();
- // }
+ // /**
+ // * Title of this TilePart ? Needed by a trace message.
+ // */
+ // protected String getTitle() {
+ // return getClass().toString();
+ // }
//
- // /**
- // *
- // */
- // protected IWorkbenchPartSite getSite() {
- // return getEditorSite();
- // }
+ // /**
+ // *
+ // */
+ // protected IWorkbenchPartSite getSite() {
+ // return getEditorSite();
+ // }
//
- // /**
- // *
- // */
- // abstract protected void firePropertyChange(int propertyId);
+ // /**
+ // *
+ // */
+ // abstract protected void firePropertyChange(int propertyId);
//
- // /**
- // *
- // */
- // abstract protected IEditorSite getEditorSite();
+ // /**
+ // *
+ // */
+ // abstract protected IEditorSite getEditorSite();
+
}
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java
index 8030ae5cea4..a905b736a53 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/internal/eclipsecopy/MultiPageSelectionProvider.java
@@ -24,9 +24,9 @@ import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart;
import org.eclipse.ui.IEditorPart;
/**
- * Manages the current selection in a multi-page editor by tracking the active
- * nested editor within the multi-page editor. When the selection changes,
- * notifications are sent to all registered listeners.
+ * Manages the current selection in a multi-page editor by tracking the active nested editor within the multi-page editor. When the selection changes,
+ * notifications are sent to all registered
+ * listeners.
*
* This class may be instantiated; it is not intended to be subclassed. The base implementation of MultiPageEditor.init
creates an
* instance of this class.
@@ -70,8 +70,7 @@ public class MultiPageSelectionProvider implements IPostSelectionProvider {
}
/**
- * Adds a listener for post selection changes in this multi page selection
- * provider.
+ * Adds a listener for post selection changes in this multi page selection provider.
*
* @param listener
* a selection changed listener
@@ -82,8 +81,7 @@ public class MultiPageSelectionProvider implements IPostSelectionProvider {
}
/**
- * Notifies all registered selection changed listeners that the editor's
- * selection has changed. Only listeners registered at the time this method
+ * Notifies all registered selection changed listeners that the editor's selection has changed. Only listeners registered at the time this method
* is called are notified.
*
* @param event
@@ -95,8 +93,7 @@ public class MultiPageSelectionProvider implements IPostSelectionProvider {
}
/**
- * Notifies all post selection changed listeners that the editor's selection
- * has changed.
+ * Notifies all post selection changed listeners that the editor's selection has changed.
*
* @param event
* the event to propogate.
@@ -119,14 +116,14 @@ public class MultiPageSelectionProvider implements IPostSelectionProvider {
}
}
- // /**
- // * Returns the multi-page editor.
- // *
- // * @return the multi-page editor.
- // */
- // private IMultiPageEditorPart getMultiPageEditor() {
- // return multiPageEditor;
- // }
+ // /**
+ // * Returns the multi-page editor.
+ // *
+ // * @return the multi-page editor.
+ // */
+ // private IMultiPageEditorPart getMultiPageEditor() {
+ // return multiPageEditor;
+ // }
/*
* (non-Javadoc) Method declared on ISelectionProvider
.
@@ -150,8 +147,7 @@ public class MultiPageSelectionProvider implements IPostSelectionProvider {
}
/**
- * Removes a listener for post selection changes in this multi page
- * selection provider.
+ * Removes a listener for post selection changes in this multi page selection provider.
*
* @param listener
* a selection changed listener
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/multipage/editor/MultiPageEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/multipage/editor/MultiPageEditor.java
index ad06108309f..45bdd224c59 100644
--- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/multipage/editor/MultiPageEditor.java
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/multipage/editor/MultiPageEditor.java
@@ -34,19 +34,19 @@ import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.MultiPageEditorPart;
/**
- * A MultiPageEditor implementation accepting IMultiSashContentProvider as
- * content provider. This implementation extends the regular eclipse
- * MultiPageEditorPart. The refresh() method allows to refresh the tabs.
+ * A MultiPageEditor implementation accepting IMultiSashContentProvider as content provider.
+ * This implementation extends the regular eclipse MultiPageEditorPart.
+ * The refresh() method allows to refresh the tabs.
*
- * The implementation do not listen on model change. This can be done by
- * subclasses. To add a new tab, one should add it as a model in the
- * ContentProvider. The addPage() methods should not be used for this purpose.
+ * The implementation do not listen on model change. This can be done by subclasses.
+ * To add a new tab, one should add it as a model in the ContentProvider. The addPage()
+ * methods should not be used for this purpose.
*
- * This implementation is intended for debug and testing purpose : it can be
- * used in place of the AbstractMultiPageSashEditor. It takes the same arguments
- * and ContentProvider, but it only allows one folder and don't deal with
- * multisashes. Also, the implementation use the regular Eclipse EditorSite
- * management. This allows to check for problems from this site management.
+ * This implementation is intended for debug and testing purpose : it can be used in place
+ * of the AbstractMultiPageSashEditor. It takes the same arguments and ContentProvider, but
+ * it only allows one folder and don't deal with multisashes.
+ * Also, the implementation use the regular Eclipse EditorSite management. This allows to check for problems from this
+ * site management.
*
* @author dumoulin
*/
@@ -74,8 +74,9 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
}
/**
- * This method is called at the end of createPartControl(). Just intercept
- * the call in order to call activate(). Create the part controls. {@inheritDoc}
+ * This method is called at the end of createPartControl().
+ * Just intercept the call in order to call activate().
+ * Create the part controls. {@inheritDoc}
*/
@Override
protected void initializePageSwitching() {
@@ -85,17 +86,18 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
}
/**
- * Method to activate the editor. Called immediately after
- * createPartControl() is complete. To be implemented by subclasses. Default
- * implementation do nothing.
+ * Method to activate the editor.
+ * Called immediately after createPartControl() is complete.
+ * To be implemented by subclasses. Default implementation do nothing.
*/
protected void activate() {
}
/**
- * Method to deactivate the editor. Called when dispose() is called. To be
- * implemented by subclasses. Default implementation do nothing.
+ * Method to deactivate the editor.
+ * Called when dispose() is called.
+ * To be implemented by subclasses. Default implementation do nothing.
*/
protected void deactivate() {
@@ -111,7 +113,7 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
public void dispose() {
deactivate();
super.dispose();
- // sashContainer.dispose();
+ // sashContainer.dispose();
}
@Override
@@ -136,6 +138,8 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
return pageProvider;
}
+
+
/**
* @param pageProvider
* the pageProvider to set
@@ -175,7 +179,11 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
setPageImage(index, image);
return index;
} catch (PartInitException e) {
- ErrorDialog.openError(getSite().getShell(), "Error creating nested text editor", null, e.getStatus());
+ ErrorDialog.openError(
+ getSite().getShell(),
+ "Error creating nested text editor",
+ null,
+ e.getStatus());
return -1;
}
@@ -188,31 +196,29 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
// get the page descriptions
pageProvider = getContentProvider();
// Get the current tabFolder
- //
+ //
tabFolderModel = lookupFolder();
refreshTabs();
- // // iterate over pages to be show
- // for( Object rawPageModel : tabFolderModel.getChildren() )
- // {
- // // Get the model interface
- // ITabItemModel tabItem = tabFolderModel.createChildSashModel(
- // rawPageModel);
- // if(tabItem instanceof IEditorModel )
- // {
- // addPage((IEditorModel)tabItem );
- // }
- // else if(tabItem instanceof IComponentModel )
- // {
- // addPage((IComponentModel)tabItem );
- // }
- // else
- // {
- // System.err.println("Can't create page for model '" + tabItem +
- // "'. Skipp it.");
- // }
- // }
+ // // iterate over pages to be show
+ // for( Object rawPageModel : tabFolderModel.getChildren() )
+ // {
+ // // Get the model interface
+ // ITabItemModel tabItem = tabFolderModel.createChildSashModel( rawPageModel);
+ // if(tabItem instanceof IEditorModel )
+ // {
+ // addPage((IEditorModel)tabItem );
+ // }
+ // else if(tabItem instanceof IComponentModel )
+ // {
+ // addPage((IComponentModel)tabItem );
+ // }
+ // else
+ // {
+ // System.err.println("Can't create page for model '" + tabItem + "'. Skipp it.");
+ // }
+ // }
}
/**
@@ -231,8 +237,8 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
}
/**
- * Recursively search in sash models for a FolderModel. Return the first
- * encountered folder.
+ * Recursively search in sash models for a FolderModel.
+ * Return the first encountered folder.
*
* @param panelModel
* @return
@@ -256,22 +262,21 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
}
/**
- * Create the provider. Subclass must implements this method. It should
- * return the provider used by the editor.
+ * Create the provider.
+ * Subclass must implements this method. It should return the provider used by the editor.
*
*/
abstract protected ISashWindowsContentProvider createPageProvider();
/**
- * Refresh the tabs order. This method should be called after the model list
- * is modified.
+ * Refresh the tabs order.
+ * This method should be called after the model list is modified.
*/
protected void refreshTabs() {
// get list of diagrams to be displayed
List> newModels = tabFolderModel.getChildren();
- // Check if each model has an open pageEditor. If not, create the
- // editor.
+ // Check if each model has an open pageEditor. If not, create the editor.
Iterator> newIter = newModels.iterator();
while(newIter.hasNext()) {
Object model = newIter.next();
@@ -283,7 +288,7 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
}
}
- // If open editor count is the same has models count,
+ // If open editor count is the same has models count,
// all models have an editor. So, end the refresh process.
if(newModels.size() == getPageCount())
return;
@@ -323,6 +328,7 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
return false;
}
+
/*
* (non-Javadoc)
*
@@ -347,8 +353,8 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
}
/**
- * Add a new editor at the end of existing editors. First, create the
- * editor, then add it to the tabs.
+ * Add a new editor at the end of existing editors.
+ * First, create the editor, then add it to the tabs.
*
* @param contentProvider
* the diagram (model) to be displayed in the editor
@@ -373,9 +379,10 @@ public abstract class MultiPageEditor extends MultiPageEditorPart {
// Add the model in the list of current tabs.
currentTabs.add(tabItem);
- // set active page
+ // set active page
setActivePage(editorIndex);
}
+
}
--
cgit v1.2.3