Search in sources :

Example 6 with ILineObject

use of com.archimatetool.model.ILineObject in project archi by archimatetool.

the class LineColorAction method run.

@Override
public void run() {
    List<?> selection = getSelectedObjects();
    ILineObject model = (ILineObject) getFirstValidSelectedModelObject(selection);
    if (model == null) {
        return;
    }
    ColorDialog colorDialog = new ColorDialog(getWorkbenchPart().getSite().getShell());
    // Set default RGB on first selected object
    RGB defaultRGB = null;
    String s = model.getLineColor();
    if (s != null) {
        defaultRGB = ColorFactory.convertStringToRGB(s);
    }
    if (defaultRGB != null) {
        colorDialog.setRGB(defaultRGB);
    } else {
        colorDialog.setRGB(new RGB(0, 0, 0));
    }
    RGB newColor = colorDialog.open();
    if (newColor != null) {
        execute(createCommand(selection, newColor));
    }
}
Also used : ColorDialog(org.eclipse.swt.widgets.ColorDialog) RGB(org.eclipse.swt.graphics.RGB) ILineObject(com.archimatetool.model.ILineObject)

Aggregations

ILineObject (com.archimatetool.model.ILineObject)6 IDiagramModelObject (com.archimatetool.model.IDiagramModelObject)3 ConnectionTextPositionCommand (com.archimatetool.editor.diagram.commands.ConnectionTextPositionCommand)2 LineWidthCommand (com.archimatetool.editor.diagram.commands.LineWidthCommand)2 Command (org.eclipse.gef.commands.Command)2 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)2 RGB (org.eclipse.swt.graphics.RGB)2 BorderColorCommand (com.archimatetool.editor.diagram.commands.BorderColorCommand)1 DiagramModelObjectAlphaCommand (com.archimatetool.editor.diagram.commands.DiagramModelObjectAlphaCommand)1 FillColorCommand (com.archimatetool.editor.diagram.commands.FillColorCommand)1 FontColorCommand (com.archimatetool.editor.diagram.commands.FontColorCommand)1 FontStyleCommand (com.archimatetool.editor.diagram.commands.FontStyleCommand)1 LineColorCommand (com.archimatetool.editor.diagram.commands.LineColorCommand)1 TextAlignmentCommand (com.archimatetool.editor.diagram.commands.TextAlignmentCommand)1 TextPositionCommand (com.archimatetool.editor.diagram.commands.TextPositionCommand)1 IBorderObject (com.archimatetool.model.IBorderObject)1 IDiagramModelConnection (com.archimatetool.model.IDiagramModelConnection)1 IFontAttribute (com.archimatetool.model.IFontAttribute)1 ITextAlignment (com.archimatetool.model.ITextAlignment)1 ITextPosition (com.archimatetool.model.ITextPosition)1