Java 类org.eclipse.draw2d.graph.DirectedGraphLayout 实例源码

项目:d-case_editor    文件:DcaseLayoutProvider.java   
/**
 * {@inheritDoc}
 */
@Override
protected DirectedGraphLayout createGraphLayout() {

    // gets target command menu.
    ICommandService commandService =
            (ICommandService) PlatformUI.getWorkbench()
                .getService(ICommandService.class);
    Command radioCommand = commandService.getCommand(CONST_ARRANGE_ANGLE_COMMAND);

    // gets current arrange direction state.
    State state = radioCommand.getState(CONST_RADIO_COMMAND_STATE);
    String currentState = state.getValue().toString();

    // sets command state to angle instance.
    if (currentState.equals(CONST_HORIZONTAL_VALUE)) {
        ArrangeAngle.createInstance().setAngle(ArrangeAngle.Direction.Horizontal);
    } else {
        ArrangeAngle.createInstance().setAngle(ArrangeAngle.Direction.Vertical);
    }

    return new DcaseDirectedGraphLayout();
}