Search in sources :

Example 46 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class FeatureReferencePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    FeatureReference entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(1);
    list.add(entity.getName());
    return list;
}
Also used : IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList) FeatureReference(org.whole.lang.frames.model.FeatureReference)

Example 47 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class VariableFeatureRightPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    VariableFeature entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(1);
    list.add(entity.getFeature());
    return list;
}
Also used : VariableFeature(org.whole.lang.frames.model.VariableFeature) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList)

Example 48 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class PartDeclarationPart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    PartDeclaration entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(4);
    list.add(entity.getPartName());
    list.add(entity.getEntityName());
    list.add(entity.getFigureName());
    list.add(entity.getEntityFeatures());
    return list;
}
Also used : PartDeclaration(org.whole.lang.editors.model.PartDeclaration) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList)

Example 49 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class InlineVariablePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    Variable entity = getModelEntity();
    List<IEntity> children = new ArrayList<IEntity>(3);
    children.add(entity.getVarType());
    children.add(entity.getVarName());
    children.add(entity.getQuantifier());
    return children;
}
Also used : Variable(org.whole.lang.commons.model.Variable) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList)

Example 50 with IEntity

use of org.whole.lang.model.IEntity in project whole by wholeplatform.

the class RootFragmentPart method createFigure.

protected IFigure createFigure() {
    // Figure f = new FreeformLayer() {
    IEntityFigure f = new EntityFigure() {

        {
            setOpaque(false);
        }

        @Override
        public void paint(Graphics graphics) {
            graphics.setAdvanced(true);
            graphics.setAntialias(SWT.ON);
            super.paint(graphics);
        }

        protected void paintFigure(Graphics graphics) {
            super.paintFigure(graphics);
            Rectangle r2 = ((IFigure) getChildren().get(0)).getBounds();
            translateToParent(r2 = r2.getCopy());
            Rectangle clipArea = graphics.getClip(new Rectangle()).expand(1, 1);
            graphics.fillRectangle(clipArea);
            graphics.setBackgroundColor(FigureConstants.hostLanguageColor);
            graphics.fillRectangle(clipArea.intersect(r2));
            graphics.setLineWidth(1);
            graphics.setLineStyle(Graphics.LINE_SOLID);
            graphics.setXORMode(false);
            IEntity rootEntity = ((RootFragment) getModelEntity()).getRootEntity().wGetAdaptee(false);
            if (rootEntity.wGetParent() instanceof RootFragment) {
                clipArea = graphics.getClip(new Rectangle()).expand(1, 1);
                int oldAlpha = graphics.getAlpha();
                graphics.setAlpha(60);
                graphics.setForegroundColor(ColorConstants.darkGray);
                graphics.setLineWidth(1);
                graphics.drawRectangle(r2.getTranslated(-1, -1).resize(1, 1));
                graphics.setForegroundColor(ColorConstants.lightGray);
                graphics.setLineWidth(5);
                graphics.drawRoundRectangle(r2.getTranslated(-4, -4).resize(7, 7), 10, 10);
                graphics.setAlpha(oldAlpha);
            } else {
                graphics.setForegroundColor(ColorConstants.lightGray);
                graphics.drawRectangle(r2.x - 1, r2.y - 1, r2.width + 1, r2.height + 1);
            }
        }

        public void validate() {
            super.validate();
            repaint();
        }
    };
    f.setLayoutManager(new StackLayout().withMargin(5).withMinorAlignment(Alignment.CENTER));
    f.setBackgroundColor(FigureUtilities.lighter(ColorConstants.gray));
    f.setOpaque(false);
    f.addLayoutListener(LayoutAnimator.getDefault());
    return f;
}
Also used : Graphics(org.eclipse.draw2d.Graphics) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) EntityFigure(org.whole.lang.ui.figures.EntityFigure) IEntityFigure(org.whole.lang.ui.figures.IEntityFigure) IEntity(org.whole.lang.model.IEntity) Rectangle(org.eclipse.draw2d.geometry.Rectangle) StackLayout(org.whole.lang.ui.layout.StackLayout) RootFragment(org.whole.lang.commons.model.RootFragment) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

IEntity (org.whole.lang.model.IEntity)1407 ArrayList (java.util.ArrayList)604 Test (org.junit.Test)241 IBindingManager (org.whole.lang.bindings.IBindingManager)141 PathExpression (org.whole.lang.queries.model.PathExpression)68 ITemplateManager (org.whole.lang.templates.ITemplateManager)61 Grammar (org.whole.lang.grammars.model.Grammar)50 TestXmlGrammar (org.whole.lang.grammars.util.TestXmlGrammar)46 FeatureDescriptor (org.whole.lang.reflect.FeatureDescriptor)43 Model (org.whole.lang.models.model.Model)40 InternalIEntity (org.whole.lang.model.InternalIEntity)38 VisitException (org.whole.lang.visitors.VisitException)35 IEntityPartViewer (org.whole.lang.ui.viewers.IEntityPartViewer)30 ModelsModel (org.whole.lang.models.codebase.ModelsModel)27 WholeIllegalArgumentException (org.whole.lang.exceptions.WholeIllegalArgumentException)26 StreamPersistenceProvider (org.whole.lang.codebase.StreamPersistenceProvider)24 ModelBuilderOperation (org.whole.lang.builders.ModelBuilderOperation)22 XmlModel (org.whole.lang.models.codebase.XmlModel)22 MissingVariableException (org.whole.lang.visitors.MissingVariableException)22 IEntityPart (org.whole.lang.ui.editparts.IEntityPart)21