Example usage for org.eclipse.jface.preference IPreferenceStore getInt

List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore getInt.

Prototype

int getInt(String name);

Source Link

Document

Returns the current value of the integer-valued preference with the given name.

Usage

From source file:fable.framework.toolbox.Activator.java

License:Open Source License

public void start(BundleContext context) throws Exception {
    super.start(context);
    IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
    // KE: It might be better to put the logger initialization in
    // fable.Activator.
    // Logger/*from   w  w w.j  a  v  a 2  s. co  m*/
    int intVal = prefs.getInt(PreferenceConstants.P_FABLE_LOGGER_LEVEL);
    //Logger logger = FableLogger.getLogger();
    //setLoggerLevel(logger, intVal);

    // Image printing
    String value = prefs.getString(PreferenceConstants.P_IMAGE_PRINT_UNITS);
    FableImagePrinter.getSettings().setUnits(value);
    value = prefs.getString(PreferenceConstants.P_IMAGE_PRINT_LEFT);
    FableImagePrinter.getSettings().setLeftString(value);
    value = prefs.getString(PreferenceConstants.P_IMAGE_PRINT_RIGHT);
    FableImagePrinter.getSettings().setRightString(value);
    value = prefs.getString(PreferenceConstants.P_IMAGE_PRINT_TOP);
    FableImagePrinter.getSettings().setTopString(value);
    value = prefs.getString(PreferenceConstants.P_IMAGE_PRINT_BOTTOM);
    FableImagePrinter.getSettings().setBottomString(value);
    intVal = prefs.getInt(PreferenceConstants.P_IMAGE_PRINT_HALIGN);
    FableImagePrinter.getSettings().setHorizontalAlign(intVal);
    intVal = prefs.getInt(PreferenceConstants.P_IMAGE_PRINT_VALIGN);
    FableImagePrinter.getSettings().setVerticalAlign(intVal);
    value = prefs.getString(PreferenceConstants.P_IMAGE_PRINT_ORIENT);
    FableImagePrinter.getSettings().setOrientation(value);

    // Print startup message (after getting the level from preferences)
    if (!loggerLevelSet) {
        loggerLevelSet = true;
        //logger.info("Fable Starting");
        //logger.info("Setting logging to " + logger.getName());
    }

    // Root logger
    intVal = prefs.getInt(PreferenceConstants.P_ROOT_LOGGER_LEVEL);

    // Add a listener for preference changes
    prefs.addPropertyChangeListener(new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            String property = event.getProperty();
            if (property.equals(PreferenceConstants.P_FABLE_LOGGER_LEVEL)) {
                String value = (String) event.getNewValue();
                // System.out.println("fable logger level=" +
                // value);
                int intValue = Integer.parseInt(value);
                //Logger logger = FableLogger.getLogger();
                //setLoggerLevel(logger, intValue);
            } else if (property.equals(PreferenceConstants.P_ROOT_LOGGER_LEVEL)) {
                String value = (String) event.getNewValue();
                // System.out.println("root logger level=" + value);
                int intValue = Integer.parseInt(value);
                //Logger rootLogger = Logger.getRootLogger();
                //setLoggerLevel(rootLogger, intValue);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_UNITS)) {
                String value = (String) event.getNewValue();
                FableImagePrinter.getSettings().setUnits(value);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_LEFT)) {
                String value = (String) event.getNewValue();
                FableImagePrinter.getSettings().setLeftString(value);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_RIGHT)) {
                String value = (String) event.getNewValue();
                FableImagePrinter.getSettings().setRightString(value);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_TOP)) {
                String value = (String) event.getNewValue();
                FableImagePrinter.getSettings().setTopString(value);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_BOTTOM)) {
                String value = (String) event.getNewValue();
                FableImagePrinter.getSettings().setBottomString(value);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_HALIGN)) {
                String value = (String) event.getNewValue();
                int intValue = Integer.parseInt(value);
                FableImagePrinter.getSettings().setHorizontalAlign(intValue);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_VALIGN)) {
                String value = (String) event.getNewValue();
                int intValue = Integer.parseInt(value);
                FableImagePrinter.getSettings().setVerticalAlign(intValue);
            } else if (property.equals(PreferenceConstants.P_IMAGE_PRINT_ORIENT)) {
                String value = (String) event.getNewValue();
                FableImagePrinter.getSettings().setOrientation(value);
            }
        }
    });
}

From source file:fable.imageviewer.component.ImageComponentUI.java

License:Open Source License

private void createImageControlMenus(final IActionBars iActionBars) {

    final IContributionManager man = iActionBars.getMenuManager();
    man.add(new Separator(getClass().getName() + "menus"));

    final IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
    int orientation = prefs.getInt(PreferenceConstants.P_ORIENT);
    iv.setOrientation(orientation);//from   w ww.j a v  a  2  s  . c o m

    // TODO Icons
    orientCombo = new MenuAction("Orientation", false);
    orientCombo.setId(getClass().getName() + orientCombo.getText());
    man.add(orientCombo);

    CheckableActionGroup group = new CheckableActionGroup();
    for (int i = 0; i < 8; i++) {
        final int index = i;
        final Action action = new Action(orientNameValues[i][0], IAction.AS_CHECK_BOX) {
            public void run() {
                iv.setOrientation(index);
            }
        };
        group.add(action);
        orientCombo.add(action);
        action.setChecked(index == orientation);
    }
    orientCombo.setToolTipText("Adjust the orientation with O parameters " + "(o11 o12 o21 o22)");

    orientCombo.setImageDescriptor(Activator.getImageDescriptor("/icons/orientation.gif"));
    man.add(new Separator(getClass().getName() + "orient"));

    // Initialize the custom saved parameters
    if (!customSavedParametersInitialized) {
        // Keep the item being processed for the possible error message
        String processing = "xName";
        try {
            iv.setXNameSave(prefs.getString(PreferenceConstants.P_COORD_XNAME));
            processing = "yName";
            iv.setYNameSave(prefs.getString(PreferenceConstants.P_COORD_YNAME));
            processing = "x0";
            iv.setX0Save(Double.parseDouble(prefs.getString(PreferenceConstants.P_COORD_X0)));
            processing = "y0";
            iv.setY0Save(Double.parseDouble(prefs.getString(PreferenceConstants.P_COORD_Y0)));
            processing = "pixelHeight";
            iv.setPixelWidthSave(Double.parseDouble(prefs.getString(PreferenceConstants.P_COORD_PIXELWIDTH)));
            processing = "pixelHeight";
            iv.setPixelHeightSave(Double.parseDouble(prefs.getString(PreferenceConstants.P_COORD_PIXELHEIGHT)));
            customSavedParametersInitialized = true;
        } catch (NumberFormatException ex) {
            FableUtils.excMsg(this, "Error setting custom coordinates" + " from preferences for " + processing,
                    ex);
        }
    }

    // Orientation
    int coordOrigin = prefs.getInt(PreferenceConstants.P_COORD);
    coordCombo = new MenuAction("Coordinates", false);
    coordCombo.setImageDescriptor(Activator.getImageDescriptor("/icons/coords.png"));
    coordCombo.setId(getClass().getName() + coordCombo.getText());
    man.add(coordCombo);
    group = new CheckableActionGroup();
    for (int i = 0; i < 5; i++) {
        final int index = i;
        final Action action = new Action(coordNameValues[i][0], IAction.AS_CHECK_BOX) {
            public void run() {
                setCoordinateChoice(index);
            }
        };
        group.add(action);
        coordCombo.add(action);
        action.setChecked(index == coordOrigin);
    }
    coordCombo.setToolTipText("Select the origin of the coordinate system for mouse movement");
    man.add(new Separator(getClass().getName() + "coord"));

    // Default (will be zero if not found)
    if (coordOrigin == COORD_CUSTOM) {
        Coordinates coordinates = iv.getCoordinates();
        try {
            coordinates.reset(coordOrigin, iv.getX0Save(), iv.getY0Save(), iv.getPixelWidthSave(),
                    iv.getPixelHeightSave(), iv.getXNameSave(), iv.getYNameSave());
        } catch (NumberFormatException ex) {
            FableUtils.excMsg(this, "Error setting custom coordinates", ex);
            coordinates.resetToDefault();
        }
    } else {
        iv.resetCoordinates();
    }

    // Palette
    int paletteIndex = prefs.getInt(PreferenceConstants.P_PALETTE);
    iv.setPalette(paletteIndex);

    lutCombo = new MenuAction("Color", false);
    lutCombo.setId(getClass().getName() + lutCombo.getText());
    lutCombo.setImageDescriptor(Activator.getImageDescriptor("/icons/color_wheel.png"));
    man.add(lutCombo);
    group = new CheckableActionGroup();
    for (final String paletteName : PaletteFactory.PALETTES.keySet()) {
        final Action action = new Action(paletteName, IAction.AS_CHECK_BOX) {
            public void run() {
                int paletteIndex = PaletteFactory.PALETTES.get(paletteName);
                iv.setPalette(paletteIndex);
                setChecked(PaletteFactory.PALETTES.get(paletteName) == paletteIndex);
            }
        };
        group.add(action);
        lutCombo.add(action);
        action.setChecked(PaletteFactory.PALETTES.get(paletteName) == paletteIndex);
    }
    lutCombo.setToolTipText("Set the Color Map");

    man.add(new Separator(getClass().getName() + "menusend"));

}

From source file:fede.workspace.eclipse.java.fields.JDISourceViewer.java

License:Apache License

/**
 * Configure the given content assistant from the preference store.
 *//*from   ww  w .j a  va 2  s.  com*/
public static void configure(ContentAssistant assistant, IColorManager manager) {

    IPreferenceStore store = getPreferenceStore();

    boolean enabled = store.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
    assistant.enableAutoActivation(enabled);

    int delay = store.getInt(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY);
    assistant.setAutoActivationDelay(delay);

    Color c = getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND, manager);
    assistant.setProposalSelectorForeground(c);

    c = getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND, manager);
    assistant.setProposalSelectorBackground(c);

    c = getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, manager);
    assistant.setContextInformationPopupForeground(c);
    assistant.setContextSelectorForeground(c);

    c = getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, manager);
    assistant.setContextInformationPopupBackground(c);
    assistant.setContextSelectorBackground(c);

    enabled = store.getBoolean(PreferenceConstants.CODEASSIST_AUTOINSERT);
    assistant.enableAutoInsert(enabled);

    configureDisplayProcessor(assistant, store);
    configureJavaSnippetProcessor(assistant, store);
}

From source file:fede.workspace.eclipse.java.fields.JDISourceViewer.java

License:Apache License

/**
 * Changes the configuration of the given content assistant according to the given property
 * change event.// w  ww .  j  a  v  a  2s . c  o  m
 */
public static void changeConfiguration(ContentAssistant assistant, PropertyChangeEvent event) {

    IPreferenceStore store = getPreferenceStore();
    String p = event.getProperty();

    if (PreferenceConstants.CODEASSIST_AUTOACTIVATION.equals(p)) {
        boolean enabled = store.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION);
        assistant.enableAutoActivation(enabled);
    } else if (PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY.equals(p)) {
        int delay = store.getInt(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY);
        assistant.setAutoActivationDelay(delay);
    } else if (PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND.equals(p)) {
        Color c = getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_FOREGROUND);
        assistant.setProposalSelectorForeground(c);
    } else if (PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND.equals(p)) {
        Color c = getColor(store, PreferenceConstants.CODEASSIST_PROPOSALS_BACKGROUND);
        assistant.setProposalSelectorBackground(c);
    } else if (PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND.equals(p)) {
        Color c = getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND);
        assistant.setContextInformationPopupForeground(c);
        assistant.setContextSelectorForeground(c);
    } else if (PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND.equals(p)) {
        Color c = getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND);
        assistant.setContextInformationPopupBackground(c);
        assistant.setContextSelectorBackground(c);
    } else if (PreferenceConstants.CODEASSIST_AUTOINSERT.equals(p)) {
        boolean enabled = store.getBoolean(PreferenceConstants.CODEASSIST_AUTOINSERT);
        assistant.enableAutoInsert(enabled);
    }

    changeDisplayProcessor(assistant, store, p);
    changeJavaSnippetProcessor(assistant, store, p);
}

From source file:fr.lip6.move.coloane.core.ui.palette.PaletteFactory.java

License:Open Source License

/**
 * @return les FlyoutPreferences utilises pour charger ou sauver
 * les preferences de la flyout palette.
 *///w w w  .j  av a 2  s.  com
public static FlyoutPreferences createPalettePreferences() {
    /**
     * Implementation of the FlyoutPreferences interface for the Coloane palette
     * @author Clment Dmoulins
     */
    class ColoaneFlyoutPreferences implements FlyoutPreferences {
        private final IPreferenceStore preferenceStore;

        /**
         * Create a FlyoutPreferences using as backend a IPreferenceStore and also set some default preferences.
         * @param preferenceStore where the preference are stored
         */
        public ColoaneFlyoutPreferences(IPreferenceStore preferenceStore) {
            this.preferenceStore = preferenceStore;
            this.preferenceStore.setDefault(PALETTE_STATE, FlyoutPaletteComposite.STATE_PINNED_OPEN);
        }

        /** {@inheritDoc} */
        @Override
        public int getDockLocation() {
            return preferenceStore.getInt(PALETTE_DOCK_LOCATION);
        }

        /** {@inheritDoc} */
        @Override
        public int getPaletteState() {
            return preferenceStore.getInt(PALETTE_STATE);
        }

        /** {@inheritDoc} */
        @Override
        public int getPaletteWidth() {
            return preferenceStore.getInt(PALETTE_SIZE);
        }

        /** {@inheritDoc} */
        @Override
        public void setDockLocation(int location) {
            preferenceStore.setValue(PALETTE_DOCK_LOCATION, location);
        }

        /** {@inheritDoc} */
        @Override
        public void setPaletteState(int state) {
            preferenceStore.setValue(PALETTE_STATE, state);
        }

        /** {@inheritDoc} */
        @Override
        public void setPaletteWidth(int width) {
            preferenceStore.setValue(PALETTE_SIZE, width);
        }
    }

    return new ColoaneFlyoutPreferences(Coloane.getInstance().getPreferenceStore());
}

From source file:fr.openpeople.rdal.model.core.diagram.providers.RdalViewProvider.java

License:Open Source License

/**
 * @generated/* w  w w  . j  ava2  s  .c  o  m*/
 */
public Edge createAbstractRequirementContainedRequirements_4016(View containerView, int index,
        boolean persisted, PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(RdalVisualIDRegistry.getType(AbstractRequirementContainedRequirementsEditPart.VISUAL_ID));
    edge.setElement(null);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
            IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
            FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
        FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
        edgeFontStyle.setFontName(fontData.getName());
        edgeFontStyle.setFontHeight(fontData.getHeight());
        edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
        edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
        org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
                IPreferenceConstants.PREF_FONT_COLOR);
        edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
        ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    return edge;
}

From source file:fr.openpeople.rdal.model.core.diagram.providers.RdalViewProvider.java

License:Open Source License

/**
 * @generated//  w ww  . ja v a 2s .  c  o m
 */
public Edge createContractualElementStakeHolders_4020(View containerView, int index, boolean persisted,
        PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(RdalVisualIDRegistry.getType(ContractualElementStakeHoldersEditPart.VISUAL_ID));
    edge.setElement(null);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
            IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
            FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
        FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
        edgeFontStyle.setFontName(fontData.getName());
        edgeFontStyle.setFontHeight(fontData.getHeight());
        edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
        edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
        org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
                IPreferenceConstants.PREF_FONT_COLOR);
        edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
        ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    return edge;
}

From source file:fr.openpeople.rdal.model.core.diagram.providers.RdalViewProvider.java

License:Open Source License

/**
 * @generated/*from  w ww .j  av  a  2s. co  m*/
 */
public Edge createAbstractRequirementVerifiedBy_4019(View containerView, int index, boolean persisted,
        PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(RdalVisualIDRegistry.getType(AbstractRequirementVerifiedByEditPart.VISUAL_ID));
    edge.setElement(null);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
            IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
            FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
        FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
        edgeFontStyle.setFontName(fontData.getName());
        edgeFontStyle.setFontHeight(fontData.getHeight());
        edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
        edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
        org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
                IPreferenceConstants.PREF_FONT_COLOR);
        edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
        ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    Node label6011 = createLabel(edge, RdalVisualIDRegistry.getType(WrappingLabelEditPart.VISUAL_ID));
    label6011.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6011 = (Location) label6011.getLayoutConstraint();
    location6011.setX(0);
    location6011.setY(40);
    return edge;
}

From source file:fr.openpeople.rdal.model.core.diagram.providers.RdalViewProvider.java

License:Open Source License

/**
 * @generated//from  w  ww .  ja va2  s  .c  om
 */
public Edge createRequirementDerivedFrom_4014(View containerView, int index, boolean persisted,
        PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(RdalVisualIDRegistry.getType(RequirementDerivedFromEditPart.VISUAL_ID));
    edge.setElement(null);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
            IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
            FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
        FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
        edgeFontStyle.setFontName(fontData.getName());
        edgeFontStyle.setFontHeight(fontData.getHeight());
        edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
        edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
        org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
                IPreferenceConstants.PREF_FONT_COLOR);
        edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
        ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    Node label6008 = createLabel(edge, RdalVisualIDRegistry.getType(WrappingLabel2EditPart.VISUAL_ID));
    label6008.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6008 = (Location) label6008.getLayoutConstraint();
    location6008.setX(0);
    location6008.setY(40);
    return edge;
}

From source file:fr.openpeople.rdal.model.core.diagram.providers.RdalViewProvider.java

License:Open Source License

/**
 * @generated// ww w  .  j av a2 s.  co  m
 */
public Edge createRequirementRefinedBy_4015(View containerView, int index, boolean persisted,
        PreferencesHint preferencesHint) {
    Connector edge = NotationFactory.eINSTANCE.createConnector();
    edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
    RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints();
    ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(RdalVisualIDRegistry.getType(RequirementRefinedByEditPart.VISUAL_ID));
    edge.setElement(null);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();

    org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore,
            IPreferenceConstants.PREF_LINE_COLOR);
    ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(),
            FigureUtilities.RGBToInteger(lineRGB));
    FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE);
    if (edgeFontStyle != null) {
        FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT);
        edgeFontStyle.setFontName(fontData.getName());
        edgeFontStyle.setFontHeight(fontData.getHeight());
        edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
        edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
        org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore,
                IPreferenceConstants.PREF_FONT_COLOR);
        edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
    }
    Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE));
    if (routing != null) {
        ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing);
    }
    Node label6009 = createLabel(edge, RdalVisualIDRegistry.getType(WrappingLabel3EditPart.VISUAL_ID));
    label6009.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6009 = (Location) label6009.getLayoutConstraint();
    location6009.setX(0);
    location6009.setY(40);
    return edge;
}