diff options
18 files changed, 270 insertions, 36 deletions
diff --git a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java index 9dc24f36e3d..ec1672614e0 100644 --- a/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java +++ b/examples/uml/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java @@ -22,6 +22,7 @@ import org.eclipse.papyrus.example.uml.comment.editor.newresource.editor.Papyrus import org.eclipse.papyrus.infra.core.editor.BackboneException; import org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory; import org.eclipse.papyrus.infra.ui.multidiagram.actionbarcontributor.ActionBarContributorRegistry; +import org.eclipse.papyrus.infra.core.sasheditor.api.IEditorPartWrapper; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel; import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; import org.eclipse.papyrus.infra.core.services.ServiceException; @@ -79,7 +80,7 @@ public class CommentEditorFactory extends AbstractEditorFactory { * * */ - class TextEditorModel implements IEditorModel { + class TextEditorModel implements IEditorPartWrapper { /** diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java index e836d0b45aa..4e5fad84b88 100644 --- a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java +++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java @@ -25,18 +25,15 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.window.Window; import org.eclipse.papyrus.editor.Activator; -import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.core.utils.ServiceUtils; import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; -import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorPart; /** * A command to be used with the Eclipse Commands Framework. - * This command is to be used with {@link SashWindowsContainer} implemented with the Di model. * This command allows to rename a nested editor. * * This command use a Transaction. @@ -98,10 +95,10 @@ public class RenameNestedEditorCommand extends AbstractHandler { TransactionalEditingDomain editingDomain = null; if (editorPart instanceof IAdaptable) { - ServicesRegistry registry = (ServicesRegistry) ((IAdaptable) editorPart).getAdapter(ServicesRegistry.class); + ServicesRegistry registry = ((IAdaptable) editorPart).getAdapter(ServicesRegistry.class); if (registry == null) { - editingDomain = (TransactionalEditingDomain) ((IAdaptable) editorPart).getAdapter(TransactionalEditingDomain.class); + editingDomain = ((IAdaptable) editorPart).getAdapter(TransactionalEditingDomain.class); } else { try { editingDomain = ServiceUtils.getInstance().getTransactionalEditingDomain(registry); @@ -114,27 +111,27 @@ public class RenameNestedEditorCommand extends AbstractHandler { if (editingDomain != null) { // If the diagram label is available, modify this one. final String diagramLabel = LabelInternationalization.getInstance().getDiagramLabelWithoutName(diagram); - if(null != diagramLabel){ + if (null != diagramLabel) { InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename diagram label", "New label:", diagramLabel, null); //$NON-NLS-1$ //$NON-NLS-2$ if (Window.OK == dialog.open()) { final String label = dialog.getValue(); editingDomain.getCommandStack().execute(LabelInternationalization.getInstance().getSetDiagramLabelCommand(editingDomain, diagram, label, null)); } - }else{ + } else { InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename an existing diagram", "New name:", diagram.getName(), null); //$NON-NLS-1$ //$NON-NLS-2$ if (dialog.open() == Window.OK) { final String name = dialog.getValue(); if (name != null && name.length() > 0) { - + Command command = new RecordingCommand(editingDomain) { - - + + @Override protected void doExecute() { diagram.setName(name); } }; - + editingDomain.getCommandStack().execute(command); } } diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/handlers/TraverseTabHandler.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/handlers/TraverseTabHandler.java index 15c4117a550..d3d50e4992f 100644 --- a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/handlers/TraverseTabHandler.java +++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/handlers/TraverseTabHandler.java @@ -1,6 +1,6 @@ /***************************************************************************** * Copyright (c) 2015 CEA LIST and others. - * + * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -10,7 +10,7 @@ * * Contributors: * Shuai Li (CEA LIST) <shuai.li@cea.fr> - Initial API and implementation - * + * *****************************************************************************/ package org.eclipse.papyrus.editor.handlers; @@ -28,27 +28,27 @@ import org.eclipse.ui.PlatformUI; /** * The handler for the next/previous tab commands that let the user navigate to * the next/previous page of the active tab-folder with Ctrl+Shift/Ctrl+Shift+Tab - * + * * @author Shuai Li */ public abstract class TraverseTabHandler extends AbstractHandler { private final boolean isPrevious; - + public TraverseTabHandler() { isPrevious = false; } - + public TraverseTabHandler(boolean isPrevious) { this.isPrevious = isPrevious; } - + @Override public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); - + if (activeWorkbenchWindow != null) { IWorkbenchPart activePart = activeWorkbenchWindow.getActivePage().getActivePart(); - + if (activePart instanceof PapyrusMultiDiagramEditor) { PapyrusMultiDiagramEditor papyrusEditor = (PapyrusMultiDiagramEditor) activePart; try { @@ -58,7 +58,7 @@ public abstract class TraverseTabHandler extends AbstractHandler { } else { nextPage = papyrusEditor.getISashWindowsContainer().getNextPage(); } - + papyrusEditor.getISashWindowsContainer().selectPage(nextPage); } catch (Exception e) { Activator.log.error(e); diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java index 52a2efbaf7e..29964ee280e 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseDiagramCommand.java @@ -4,11 +4,9 @@ import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.utils.IPageUtils; -import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer; /** * A command to be used with the Eclipse Commands Framework. - * This command is to be used with {@link SashWindowsContainer} implemented with the Di model. * This command allows to close the currently openened diagram. * * @author cedric dumoulin diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java index 8871febfff4..8816df28847 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor.di/custom-src/org/eclipse/papyrus/infra/core/sasheditor/di/contentprovider/commands/CloseOtherDiagramsCommand.java @@ -3,11 +3,9 @@ package org.eclipse.papyrus.infra.core.sasheditor.di.contentprovider.commands; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer; /** * A command to be used with the Eclipse Commands Framework. - * This command is to be used with {@link SashWindowsContainer} implemented with the Di model. * This command allows to close all diagrams in the folder, except the currently openened one. * * @author cedric dumoulin diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF index 779ecd47a72..7e99193a84d 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/META-INF/MANIFEST.MF @@ -1,10 +1,11 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.infra.core.sasheditor, + org.eclipse.papyrus.infra.core.sasheditor.api, org.eclipse.papyrus.infra.core.sasheditor.contentprovider, org.eclipse.papyrus.infra.core.sasheditor.contentprovider.simple, org.eclipse.papyrus.infra.core.sasheditor.editor, org.eclipse.papyrus.infra.core.sasheditor.editor.actionbarcontributor, - org.eclipse.papyrus.infra.core.sasheditor.internal;x-internal:=true, + org.eclipse.papyrus.infra.core.sasheditor.internal;x-friends:="org.eclipse.papyrus.editor", org.eclipse.papyrus.infra.core.sasheditor.internal.eclipsecopy;x-internal:=true, org.eclipse.papyrus.infra.core.sasheditor.multipage.editor, org.eclipse.papyrus.infra.core.sasheditor.utils diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/PapyrusInfraCore.usecases b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/PapyrusInfraCore.usecases new file mode 100644 index 00000000000..11540c6d382 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/PapyrusInfraCore.usecases @@ -0,0 +1,22 @@ +# Requirements defined for the papyrus infra Core sash Editor plug-in + +# General Requirements +Requirement: Req_001: Papyrus shall provide to the developer, elements to install its own IEditorPart inside the sash editor. +Code instruction: +- the IEditorPart shall be integrated by using a class that implements org.eclipse.papyrus.infra.core.api.IEditorPartWrapper +- this obtained class shall be provided by the factory from org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory +- the factory shall be referenced by the extension org.eclipse.papyrus.infra.ui.papyrusDiagram (not only diagram...) + +Requirement: Req_002: Papyrus shall provide to the developer, elements to display its own swt.composite as an editor ( cf req_001) as inside the sash editor. +Code instruction: +- editor shall be integrated by using a class that implements org.eclipse.papyrus.infra.core.sasheditor.api.ISWTCompositeWrapper +- this class shall be provided by the factory from org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory +- the factory shall be reference by the extension org.eclipse.papyrus.infra.ui.papyrusDiagram + +Requirement: Req_003: Papyrus shall provide to the developer an access point to have access to open/ closed editor +Code instruction: +- to get the ISashWindowContainer see org.eclipse.papyrus.infra.core.sasheditor.api.EditorAccessFunction + +Requirement: Req_004: Papyrus shall provide to the developer an access point to have the active editor +Code instruction: +- to get the Ipage or the active Editor see org.eclipse.papyrus.infra.core.sasheditor.api.EditorAccessFunction
\ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/EditorAccessFunction.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/EditorAccessFunction.java new file mode 100644 index 00000000000..daf9d429092 --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/EditorAccessFunction.java @@ -0,0 +1,51 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Patrick Tessier (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sasheditor.api; + +import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart; +import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer; + +/** + * this class provides to the developer an access point to have access to open/ closed editor + * + */ +public class EditorAccessFunction { + + /** + * Shortcut to get the SashContainer from the multipage editor, for example papyrus. + * + * @param multiPageEditorPart + * @return null or the ISashWindowsContainer + */ + public static ISashWindowsContainer getSashContainerFromEditor(IMultiPageEditorPart multiPageEditorPart) { + return multiPageEditorPart.getAdapter(ISashWindowsContainer.class); + } + + /** + * getActivePage from a multipage Editor + * + * @param multiPageEditorPart + * @return null or the activeEditor + */ + public static IPapyrusEditor getActiveEditor(IMultiPageEditorPart multiPageEditorPart) { + ISashWindowsContainer sashContainer = getSashContainerFromEditor(multiPageEditorPart); + if ((sashContainer != null) && !sashContainer.isDisposed()) { + IPapyrusEditor activePage = sashContainer.getActiveSashWindowsPage(); + return activePage; + } + return null; + } +}
\ No newline at end of file diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IEditorPartWrapper.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IEditorPartWrapper.java new file mode 100644 index 00000000000..3e8f886fd3e --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IEditorPartWrapper.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Patrick Tessier (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sasheditor.api; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.EditorActionBarContributor; + +/** + * This class is used to create a wrapper. From which you can launch an IeditorPart that can be seen by Papyrus Core. + * see also org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory to create a factory that provide it + * see also the extension point to reference the factory org.eclipse.papyrus.infra.ui.papyrusDiagram + */ +public interface IEditorPartWrapper extends IEditorModel, IPapyrusEditorDeclaration { + + /** + * Create the Eclipse Editor that should be shown inside Papyrus + * + * + * @return A new instance of the IEditorPart. + */ + @Override + public IEditorPart createIEditorPart() throws PartInitException; + + /** + * Get the EditorActionBarContributor that should be associated with the editor . + * + * @return + */ + @Override + public EditorActionBarContributor getActionBarContributor(); + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IPapyrusEditor.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IPapyrusEditor.java new file mode 100644 index 00000000000..24f55957adf --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IPapyrusEditor.java @@ -0,0 +1,46 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sasheditor.api; + +/***************************************************************************** + * Copyright (c) 2019 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Patrick Tessier (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ + +/** + * This is the super type of real editors contained by the sashEditor + * see also PapyrusDeclaration useful to add it by extension point + * in the runtime a IpapyrusEditorDeclaration becomes a IPapyrus Editor + * + * @see org.eclipse.papyrus.infra.core.sasheditor.api.IEditorPartWrapper + * @see org.eclipse.papyrus.infra.core.sasheditor.api.ISWTCompositeWrapper + */ + + + +public interface IPapyrusEditor { + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IPapyrusEditorDeclaration.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IPapyrusEditorDeclaration.java new file mode 100644 index 00000000000..923b0b392bc --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/IPapyrusEditorDeclaration.java @@ -0,0 +1,27 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Patrick Tessier (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.core.sasheditor.api; + +/** + * This is the super type of editors declaration contained by the sashEditor + * This only a declaration to set the semantic. + * + * @see org.eclipse.papyrus.infra.core.sasheditor.api.IEditorPartWrapper + * @see org.eclipse.papyrus.infra.core.sasheditor.api.ISWTCompositeWrapper + */ +public interface IPapyrusEditorDeclaration { + +} diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/ISWTCompositeWrapper.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/ISWTCompositeWrapper.java new file mode 100644 index 00000000000..77bbf1375be --- /dev/null +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/api/ISWTCompositeWrapper.java @@ -0,0 +1,38 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Patrick Tessier (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.core.sasheditor.api; + +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IComponentModel; +import org.eclipse.swt.widgets.Composite; + +/** + * Papyrus shall provide to the developer, elements to display its own swt.composite as an editor as inside the sash editor. + * see also org.eclipse.papyrus.infra.ui.extension.diagrameditor.AbstractEditorFactory to create a factory that provide it + * see also the extension point to reference the factory org.eclipse.papyrus.infra.ui.papyrusDiagram + */ +public interface ISWTCompositeWrapper extends IComponentModel, IPapyrusEditorDeclaration { + + /** + * Create the Control corresponding to this model. + * + * @param parent + * The parent of the created container. + * @return + */ + @Override + public Composite createPartControl(Composite parent); + +} 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 74a84eec30f..79c1e15543c 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 @@ -11,6 +11,7 @@ * * Contributors: * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation + * Patrick Tessier (CEA LIST) - add comments * *****************************************************************************/ package org.eclipse.papyrus.infra.core.sasheditor.contentprovider; @@ -21,6 +22,9 @@ import org.eclipse.ui.part.EditorActionBarContributor; /** * This model indicate that an Editor should be drawn in the sash window folder. + * This class is used to create an editor that can be integrated by Papyrus Core. This the inking point for a papyrus editor + * + * see org.eclipse.papyrus.infra.core.api.IEditorAnchorPoint * * @author dumoulin * 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 f2df50d14c2..c498c5cf5b8 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 @@ -12,6 +12,7 @@ * * CEA LIST - Initial API and implementation * Christian W. Damus (CEA) - bug 392301 + * Patrick Tessier (CEA LIST) add comments * *****************************************************************************/ package org.eclipse.papyrus.infra.core.sasheditor.contentprovider; @@ -24,7 +25,9 @@ import org.eclipse.swt.graphics.Image; * 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. + * To implement a new editor see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel * + * @see org.eclipse.papyrus.infra.core.sasheditor.api.IPapyrusEditorDeclaration * @author dumoulin * */ diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IMultiPageEditorPart.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IMultiPageEditorPart.java index f5aa31fbd40..c6ce98b7ea3 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IMultiPageEditorPart.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IMultiPageEditorPart.java @@ -15,6 +15,7 @@ *****************************************************************************/ package org.eclipse.papyrus.infra.core.sasheditor.editor; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorSite; import org.eclipse.ui.IWorkbenchPartSite; @@ -23,7 +24,7 @@ import org.eclipse.ui.IWorkbenchPartSite; * Marker to mark a EditorPart as a MultiPartEditor. Provides methods needed by classes * like MultiPageActionBarContributor and MultiPageSelectionProvider. */ -public interface IMultiPageEditorPart { +public interface IMultiPageEditorPart extends IAdaptable { /** * Get the currently active editor of the MultiPageEditorPart. diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IPage.java b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IPage.java index 0bee32e3ccd..085ee27f3fe 100644 --- a/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IPage.java +++ b/plugins/infra/core/org.eclipse.papyrus.infra.core.sasheditor/src/org/eclipse/papyrus/infra/core/sasheditor/editor/IPage.java @@ -3,6 +3,7 @@ */ package org.eclipse.papyrus.infra.core.sasheditor.editor; +import org.eclipse.papyrus.infra.core.sasheditor.api.IPapyrusEditor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Control; @@ -15,7 +16,7 @@ import org.eclipse.swt.widgets.Control; * @author cedric dumoulin * */ -public interface IPage { +public interface IPage extends IPapyrusEditor { /** * Get the title to be shown in the tab 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 5495148f3d6..838fd07eac2 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 @@ -15,7 +15,6 @@ package org.eclipse.papyrus.infra.core.sasheditor.editor; -import org.eclipse.papyrus.infra.core.sasheditor.Activator; import org.eclipse.papyrus.infra.core.sasheditor.internal.SashWindowsContainer; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPropertyListener; @@ -86,8 +85,7 @@ public class SashTabDecorationSynchronizer { @Override 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); } @@ -138,9 +136,7 @@ public class SashTabDecorationSynchronizer { * @param page */ protected void attachPage(IPage page) { - if (page instanceof IEditorPage) - { - Activator.log.debug("attachPage( " + page + " )"); + if (page instanceof IEditorPage) { IEditorPage editorPage = (IEditorPage) page; editorPage.getIEditorPart().addPropertyListener(editorPartPropertyListener); } 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 6655c0f792a..5cf339c79e2 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 @@ -50,7 +50,10 @@ import org.eclipse.ui.part.MultiPageEditorPart; * site management. * * @author dumoulin + * @deprecated + * @since 4.4 */ +@Deprecated public abstract class MultiPageEditor extends MultiPageEditorPart { /** The pageProvider */ @@ -62,7 +65,7 @@ public abstract class MultiPageEditor extends MultiPageEditorPart { private ITabFolderModel tabFolderModel; /** Ordered set of currently shown diagrams */ - protected List<IPageModel> currentTabs = new ArrayList<IPageModel>(); + protected List<IPageModel> currentTabs = new ArrayList<>(); /** * Constructor. @@ -302,7 +305,7 @@ public abstract class MultiPageEditor extends MultiPageEditorPart { // There is some extra editors ! remove them. // remove extra editors : for each open editor, check if its model is in // the list of required models. - List<IPageModel> toBeRemoved = new ArrayList<IPageModel>(); + List<IPageModel> toBeRemoved = new ArrayList<>(); Iterator<IPageModel> currentIter = currentTabs.iterator(); while (currentIter.hasNext()) { IPageModel model = currentIter.next(); |