-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Customized ComponentPort images now rotate properly
Signed-off-by: Felix Dorner <felix.dorner@gmail.com>
- Loading branch information
Showing
50 changed files
with
284 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
plugins/ms.design/description/Contextual Component Detailed Interfaces/ms.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Custom images for Contextual Component Detailed Interfaces diagrams | ||
*/ | ||
ComponentPort[kind=STANDARD][providedInterfaces].vpms-all-undefined { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_provided.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][requiredInterfaces].vpms-all-undefined { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_required.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces][requiredInterfaces].vpms-all-undefined { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_providedrequired.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces].vpms-excluded { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_provided-red.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][requiredInterfaces].vpms-excluded { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_required-red.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces][requiredInterfaces].vpms-excluded { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_providedrequired-red.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces].vpms-excluded.vpms-included { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_provided-purple.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][requiredInterfaces].vpms-excluded.vpms-included { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_required-purple.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces][requiredInterfaces].vpms-excluded.vpms-included { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_providedrequired-purple.png'; | ||
} | ||
|
40 changes: 40 additions & 0 deletions
40
plugins/ms.design/description/Contextual Component External Interfaces/ms.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Custom images for Contextual Component External Interfaces Diagrams | ||
*/ | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces].vpms-all-undefined { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_provided.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][requiredInterfaces].vpms-all-undefined { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_required.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces][requiredInterfaces].vpms-all-undefined { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_providedrequired.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces].vpms-excluded { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_provided-red.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][requiredInterfaces].vpms-excluded { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_required-red.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces][requiredInterfaces].vpms-excluded { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_providedrequired-red.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces].vpms-excluded.vpms-included { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_provided-purple.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][requiredInterfaces].vpms-excluded.vpms-included { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_required-purple.png'; | ||
} | ||
|
||
ComponentPort[kind=STANDARD][providedInterfaces][requiredInterfaces].vpms-excluded.vpms-included { | ||
image: '/ms.design/images/vpms-rotating/StandardPort_providedrequired-purple.png'; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
File renamed without changes
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
Binary file added
BIN
+7.6 KB
plugins/ms.design/images/vpms-rotating/StandardPort_provided-purple.png
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
Binary file added
BIN
+9.84 KB
plugins/ms.design/images/vpms-rotating/StandardPort_providedrequired-purple.png
Oops, something went wrong.
Binary file added
BIN
+9.56 KB
plugins/ms.design/images/vpms-rotating/StandardPort_providedrequired-red.png
Oops, something went wrong.
File renamed without changes
Binary file added
BIN
+8.28 KB
plugins/ms.design/images/vpms-rotating/StandardPort_required-purple.png
Oops, something went wrong.
Oops, something went wrong.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
plugins/ms.design/src/ms/design/RotativeImageEditPartProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2006, 2019 THALES GLOBAL SERVICES. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Thales - initial API and implementation | ||
*******************************************************************************/ | ||
package ms.design; | ||
|
||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.core.runtime.Path; | ||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; | ||
import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider; | ||
import org.eclipse.gmf.runtime.notation.View; | ||
import org.eclipse.sirius.diagram.DNode; | ||
import org.eclipse.sirius.diagram.WorkspaceImage; | ||
import org.eclipse.sirius.diagram.ui.internal.edit.parts.DNode4EditPart; | ||
import org.eclipse.sirius.diagram.ui.internal.edit.parts.WorkspaceImageEditPart; | ||
import org.polarsys.capella.core.sirius.analysis.editpart.RotativeDNode4EditPart; | ||
import org.polarsys.capella.core.sirius.analysis.editpart.RotativeImageEditPart; | ||
|
||
/** | ||
* Specific Edit Part Provider for rotative image | ||
*/ | ||
public class RotativeImageEditPartProvider extends AbstractEditPartProvider { | ||
|
||
@Override | ||
protected Class<?> getNodeEditPartClass(final View view) { | ||
String type = view.getType(); | ||
|
||
if (type != null) { | ||
EObject resolvedSemanticElement = ViewUtil.resolveSemanticElement(view); | ||
if (resolvedSemanticElement != null) { | ||
|
||
if (String.valueOf(WorkspaceImageEditPart.VISUAL_ID).equals(type)) { | ||
if (resolvedSemanticElement instanceof WorkspaceImage) { | ||
final WorkspaceImage customStyle = (WorkspaceImage) resolvedSemanticElement; | ||
if (isRotative(customStyle)) { | ||
return RotativeImageEditPart.class; | ||
} | ||
} | ||
} else if (String.valueOf(DNode4EditPart.VISUAL_ID).equals(type)) { | ||
if (resolvedSemanticElement instanceof DNode) { | ||
|
||
DNode spec = (DNode) resolvedSemanticElement; | ||
if (spec.getOwnedStyle() != null && spec.getOwnedStyle() instanceof WorkspaceImage) { | ||
if (isRotative((WorkspaceImage) spec.getOwnedStyle())) { | ||
return RotativeDNode4EditPart.class; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
return super.getNodeEditPartClass(view); | ||
} | ||
|
||
private boolean isRotative(WorkspaceImage ownedStyle_p) { | ||
IPath path = new Path(ownedStyle_p.getWorkspacePath()); | ||
if (path.segmentCount() >= 2) { | ||
String folder = path.segment(path.segmentCount() - 2); | ||
return "vpms-rotating".equals(folder); | ||
} | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.