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

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

Introduction

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

Prototype

void setDefault(String name, boolean value);

Source Link

Document

Sets the default value for the boolean-valued preference with the given name.

Usage

From source file:com.legstar.eclipse.plugin.cixscom.preferences.AbstractCicxsPreferenceInitializer.java

License:Open Source License

/**
 * Preference initializers inheriting from this class must call this method
 * in order to initialize common fields.
 * @param store the data store where initial values are kept
 *///w w  w  .j a  va2 s. c  o  m
public void initializeDefaultPreferences(final IPreferenceStore store) {

    store.setDefault(PreferenceConstants.DEFAULT_CIXS_PACKAGE_NAME_PREFIX, "com.legstar.test.cixs");
    store.setDefault(PreferenceConstants.DEFAULT_CIXS_TARGET_DIST_FOLDER, "dist");
}

From source file:com.legstar.eclipse.plugin.common.preferences.PreferenceInitializer.java

License:Open Source License

/**
 * {@inheritDoc}//from  ww  w . ja va2 s. co m
 * @see org.eclipse.core.runtime.preferences.
 * AbstractPreferenceInitializer#initializeDefaultPreferences()
 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setDefault(PreferenceConstants.ANT_SCRIPTS_FOLDER, "ant");
    store.setDefault(PreferenceConstants.HOST_CHARSET, "IBM01140");
}

From source file:com.legstar.eclipse.plugin.jaxwsgen.preferences.PreferenceInitializer.java

License:Open Source License

/**
 * {@inheritDoc}//w  w  w  . ja  v  a  2  s.c  o  m
 * @see org.eclipse.core.runtime.preferences.
 * AbstractPreferenceInitializer#initializeDefaultPreferences()
 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    super.initializeDefaultPreferences(store);

    store.setDefault(PreferenceConstants.DEFAULT_J2EE_WAR_FOLDER, getDefaultJ2eeLocation() + "/webapps");

    store.setDefault(PreferenceConstants.DEFAULT_J2EE_WDD_FOLDER, "webapp/WEB-INF");

    store.setDefault(PreferenceConstants.ADAPTER_WSDL_TARGET_NAMESPACE_PREFIX,
            Jaxws2CixsGenerator.DEFAULT_WSDL_TARGET_NAMESPACE_PREFIX);
    store.setDefault(PreferenceConstants.ADAPTER_WSDL_SERVICE_NAME_SUFFIX,
            Jaxws2CixsGenerator.DEFAULT_WSDL_SERVICE_NAME_SUFFIX);
    store.setDefault(PreferenceConstants.ADAPTER_WSDL_PORT_NAME_SUFFIX,
            Jaxws2CixsGenerator.DEFAULT_WSDL_PORT_NAME_SUFFIX);

    store.setDefault(PreferenceConstants.PROXY_DEFAULT_HTTP_SCHEME, "http");

    store.setDefault(PreferenceConstants.PROXY_DEFAULT_HTTP_HOST, CodeGenUtil.getLocalIPAddress());

    store.setDefault(PreferenceConstants.PROXY_DEFAULT_HTTP_PORT, 8080);

    store.setDefault(PreferenceConstants.PROXY_HTTP_PATH_TEMPLATE,
            Cixs2JaxwsGenerator.DEFAULT_SERVER_PATH_TEMPLATE);

    store.setDefault(PreferenceConstants.DEFAULT_COBOL_SAMPLE_FOLDER, "cobol");
}

From source file:com.legstar.eclipse.plugin.mulegen.preferences.PreferenceInitializer.java

License:Open Source License

/**
 * {@inheritDoc}/*  w  w  w  . j a  v  a2 s.c  o m*/
 * @see org.eclipse.core.runtime.preferences.
 * AbstractPreferenceInitializer#initializeDefaultPreferences()
 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    super.initializeDefaultPreferences(store);

    store.setDefault(PreferenceConstants.MULE_INSTALL_FOLDER, getDefaultMuleLocation());
    store.setDefault(PreferenceConstants.MULE_APPS_FOLDER, getDefaultMuleLocation() + "/apps");

    store.setDefault(PreferenceConstants.TARGET_MULE_CONFIG_FOLDER, "conf");
    store.setDefault(PreferenceConstants.DEFAULT_COBOL_SAMPLE_FOLDER, "cobol");

    /* --------------------------------------------------------------------- */
    /* Adapter to Mainframe HTTP transport preferences.                      */
    /* --------------------------------------------------------------------- */
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_HTTP_HOST, "mainframe");
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_HTTP_PORT, "4081");
    store.setDefault(PreferenceConstants.ADAPTER_HTTP_PATH, "/CICS/CWBA/LSWEBBIN");

    /* --------------------------------------------------------------------- */
    /* Adapter to Mainframe WMQ transport preferences.                       */
    /* --------------------------------------------------------------------- */
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_WMQ_JNDI_URL,
            WmqTransportParameters.DEFAULT_JNDI_FS_DIRECTORY);
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_WMQ_JNDI_CONTEXT_FACTORY,
            WmqTransportParameters.DEFAULT_JNDI_CONTEXT_FACTORY);
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_WMQ_CONNECTION_FACTORY, "ConnectionFactory");
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_WMQ_ZOS_QUEUE_MANAGER, "CSQ1");
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_WMQ_REQUEST_QUEUE, "CICS01.BRIDGE.REQUEST.QUEUE");
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_WMQ_REPLY_QUEUE, "CICS01.BRIDGE.REPLY.QUEUE");
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_WMQ_ERROR_QUEUE, "");

    /* --------------------------------------------------------------------- */
    /* Adapter to Mainframe TCP transport preferences.                       */
    /* --------------------------------------------------------------------- */
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_TCP_HOST, "mainframe");
    store.setDefault(PreferenceConstants.ADAPTER_DEFAULT_TCP_PORT, "3011");

    /* --------------------------------------------------------------------- */
    /* Mainframe to Proxy HTTP transport preferences.                        */
    /* --------------------------------------------------------------------- */
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_HTTP_HOST, CodeGenUtil.getLocalIPAddress());
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_HTTP_PORT, AntBuildCixs2MuleModel.DEFAULT_HTTP_PORT);
    store.setDefault(PreferenceConstants.PROXY_HTTP_PATH_TEMPLATE,
            AntBuildCixs2MuleModel.DEFAULT_SERVER_PATH_TEMPLATE);

    /* --------------------------------------------------------------------- */
    /* Mainframe to Proxy WMQ transport preferences.                         */
    /* --------------------------------------------------------------------- */
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_WMQ_JNDI_URL,
            WmqTransportParameters.DEFAULT_JNDI_FS_DIRECTORY);
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_WMQ_JNDI_CONTEXT_FACTORY,
            WmqTransportParameters.DEFAULT_JNDI_CONTEXT_FACTORY);
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_WMQ_CONNECTION_FACTORY, "ConnectionFactory");
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_WMQ_ZOS_QUEUE_MANAGER, "CSQ1");
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_WMQ_REQUEST_QUEUE_SUFFIX,
            WmqTransportParameters.DEFAULT_REQUEST_QUEUE_SUFFIX);
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_WMQ_REPLY_QUEUE_SUFFIX,
            WmqTransportParameters.DEFAULT_REPLY_QUEUE_SUFFIX);
    store.setDefault(PreferenceConstants.PROXY_DEFAULT_WMQ_ERROR_QUEUE_SUFFIX,
            WmqTransportParameters.DEFAULT_ERROR_QUEUE_SUFFIX);

}

From source file:com.legstar.eclipse.plugin.schemagen.preferences.PreferenceInitializer.java

License:Open Source License

/**
 * {@inheritDoc}//from w w w.  java 2 s.  c  om
 * 
 * @see org.eclipse.core.runtime.preferences.
 *      AbstractPreferenceInitializer#initializeDefaultPreferences()
 */
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    store.setDefault(PreferenceConstants.COBOL_FILES_ENCODING, Charset.defaultCharset().name());

    /*
     * -------------------------------------------------------------------
     * COBOL source format related options
     */
    store.setDefault(PreferenceConstants.DEFAULT_CODE_FORMAT, CodeFormat.FIXED_FORMAT.toString());

    store.setDefault(PreferenceConstants.DEFAULT_START_COLUMN, Cob2XsdModel.DEFAULT_START_COLUMN);

    store.setDefault(PreferenceConstants.DEFAULT_END_COLUMN, Cob2XsdModel.DEFAULT_END_COLUMN);

    /*
     * -------------------------------------------------------------------
     * XML Schema related default options
     */
    store.setDefault(PreferenceConstants.XSD_NAMESPACE_PREFIX, "http://coxb.test.legstar.com");
    store.setDefault(PreferenceConstants.DEFAULT_XSD_ENCODING, Cob2XsdModel.DEFAULT_XSD_ENCODING);
    store.setDefault(PreferenceConstants.DEFAULT_XSD_MAP_CONDITIONS_TO_FACETS, false);
    store.setDefault(PreferenceConstants.DEFAULT_XSD_CUSTOM_XSLT_FILE_NAME, "");
    store.setDefault(PreferenceConstants.DEFAULT_XSD_NAME_CONFLICT_PREPEND_PARENT_NAME, false);
    store.setDefault(PreferenceConstants.DEFAULT_XSD_ELEMENT_NAMES_START_WITH_UPPERCASE, false);

    /*
     * -------------------------------------------------------------------
     * LegStar annotations default options
     */
    store.setDefault(PreferenceConstants.DEFAULT_ADD_LEGSTAR_ANNOTATIONS, true);

    /*
     * -------------------------------------------------------------------
     * COBOL compiler related options
     */
    store.setDefault(PreferenceConstants.DEFAULT_CURRENCY_SIGN, Cob2XsdModel.DEFAULT_CURRENCY_SIGN);
    store.setDefault(PreferenceConstants.DEFAULT_CURRENCY_SYMBOL, Cob2XsdModel.DEFAULT_CURRENCY_SYMBOL);
    store.setDefault(PreferenceConstants.DEFAULT_DECIMAL_POINT_IS_COMMA, false);
    store.setDefault(PreferenceConstants.DEFAULT_NSYMBOL_DBCS, false);
    store.setDefault(PreferenceConstants.DEFAULT_QUOTE_IS_QUOTE, true);
}

From source file:com.litrik.eclipse.xps.preferences.XPSPreferenceInitializer.java

License:Apache License

public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setDefault(XPSPreferenceConstants.P_JUNIT_ENABLED, true);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_COLOR_START, 5);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_COLOR_FAILURE, 1);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_COLOR_SUCCESS, 5);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_LOCATION_FANS, true);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_LOCATION_SPEAKERS, true);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_LOCATION_PANEL, true);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_BRIGHTNESS, 7);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_PULSATE, true);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_TIMEOUT_SUCCESS, 5);
    store.setDefault(XPSPreferenceConstants.P_JUNIT_TIMEOUT_FAILURE, 0);
}

From source file:com.matlab.eclipse.mconsole.internal.ui.preferences.PreferenceInitializer.java

License:Open Source License

public void initializeDefaultPreferences() {
    IPreferenceStore store = MConsolePlugin.getDefault().getPreferenceStore();
    store.setDefault(IPreferenceConstants.P_MATLABPATH, "/usr/local/bin");
    store.setDefault(IPreferenceConstants.P_MATLABINTERPRETER, "matlab");
    store.setDefault(IPreferenceConstants.P_COMMANDHISTORY, "Default value");
    store.setDefault(IPreferenceConstants.P_REMEMBERCOMMANDHISTORY, true);
    store.setDefault(IPreferenceConstants.P_CDFEEDBACK, false);
    store.setDefault(IPreferenceConstants.P_AUTOMATICCD, true);
    store.setDefault(IPreferenceConstants.P_AUTOMATICCDEDITOR, true);
    store.setDefault(IPreferenceConstants.P_SHRINKOUTPUT, true);
}

From source file:com.mentor.nucleus.bp.ui.canvas.CanvasPlugin.java

License:Open Source License

private void initializeCanvases() {
    Ooaofgraphics graphicsModelRoot = Ooaofgraphics.getDefaultInstance();
    IExtensionRegistry reg = Platform.getExtensionRegistry();
    IExtensionPoint extPt = reg.getExtensionPoint("com.mentor.nucleus.bp.core.editors"); //$NON-NLS-1$
    IExtension[] exts = extPt.getExtensions();
    IPreferenceStore prefStore = CanvasPlugin.getDefault().getPreferenceStore();
    for (int i = 0; i < exts.length; i++) {
        IConfigurationElement[] elems = exts[i].getConfigurationElements();
        for (int j = 0; j < elems.length; j++) {
            if (elems[j].getName().equals("editor")) { //$NON-NLS-1$
                IConfigurationElement[] defs = elems[j].getChildren();
                for (int k = 0; k < defs.length; k++) {
                    int value = 0;
                    if (defs[k].getName().equals("symbol")) {
                        String className = defs[k].getAttribute("class");
                        if (!className.equals("")) {
                            String symTypDef = defs[k].getAttribute("elemType");
                            if (symTypDef != null) {
                                int elemType = getValueFor(symTypDef);
                                String elemName = defs[k].getAttribute("name");
                                ElementSpecification_c es = new ElementSpecification_c(graphicsModelRoot);
                                es.setName(elemName);
                                es.setOoa_type(elemType);
                                IConfigurationElement[] col = defs[k].getChildren("color");
                                if (col != null && col.length > 0) {
                                    int r = Integer.parseInt(col[0].getAttribute("r"));
                                    int g = Integer.parseInt(col[0].getAttribute("g"));
                                    int b = Integer.parseInt(col[0].getAttribute("b"));
                                    String clrStr = Integer.toString(r) + "," + Integer.toString(g) + ","
                                            + Integer.toString(b);
                                    String prefStr = "CanvasPreferencePage." + elemName + ".intColor";
                                    prefStore.setDefault(prefStr, clrStr);
                                    clrStr = prefStore.getString(prefStr);
                                    if (clrStr == null || clrStr.equals("")) {
                                        // The preference is not set, set it to the default
                                        prefStore.setToDefault(prefStr);
                                        clrStr = prefStore.getString(prefStr);
                                    }//  w  ww.java  2 s.c o  m
                                    es.setInternal(parseColor(clrStr));
                                } else {
                                    es.setHasnointeriorcolor(true);
                                    es.setInternal(parseColor("255,255,255"));
                                }
                                try {
                                    es.setRepresents(Class.forName(className));
                                } catch (ClassNotFoundException e) {
                                    logError("Specified metamodel class not found: ", e);
                                }
                                es.setCreator(defs[k].getAttribute("createMethod"));
                                es.setIconname(defs[k].getAttribute("icon"));
                                String defHStr = defs[k].getAttribute("defaultHeight");
                                String defWStr = defs[k].getAttribute("defaultWidth");
                                if (defHStr != null) {
                                    int defH = Integer.parseInt(defHStr);
                                    es.setDefaultheight(defH);
                                }
                                if (defWStr != null) {
                                    int defW = Integer.parseInt(defWStr);
                                    es.setDefaultwidth(defW);
                                }
                                String isFixedAspectStr = defs[k].getAttribute("fixedAspect");
                                if (isFixedAspectStr != null && isFixedAspectStr.equals("true")) {
                                    es.setIsfixedaspectratio(true);
                                }
                                String isFixedSizeStr = defs[k].getAttribute("fixedSize");
                                if (isFixedSizeStr != null && isFixedSizeStr.equals("true")) {
                                    es.setIsfixedsize(true);
                                }
                                String isAnchorHost = defs[k].getAttribute("isAnchorHost");
                                if (isAnchorHost != null && isAnchorHost.equals("true")) {
                                    es.setIsanchorhost(true);
                                }
                                String hasFloatingStr = defs[k].getAttribute("floatingText");
                                if (hasFloatingStr != null && hasFloatingStr.equals("true")) {
                                    es.setHasfloatingtext(true);
                                }
                                String layer = defs[k].getAttribute("layer");
                                if (layer != null) {
                                    try {
                                        es.setLayer(Integer.parseInt(layer));
                                    } catch (NumberFormatException e) {
                                        logError("Could not parse symbol '" + elemName + "' layer: ", e);
                                    }
                                }
                                String antiAliased = defs[k].getAttribute("antiAliased");
                                if (antiAliased != null) {
                                    if (antiAliased.equalsIgnoreCase("true")) {
                                        es.setAntialiased(true);
                                    } else {
                                        es.setAntialiased(false);
                                    }
                                } else {
                                    // default to false until drawing performance is enhanced
                                    es.setAntialiased(false);
                                }
                                String isTransparent = defs[k].getAttribute("isTransparent");
                                if (isTransparent != null && isTransparent.equalsIgnoreCase("true")) {
                                    es.setIstransparent(true);
                                } else {
                                    es.setIstransparent(false);
                                }
                                String creationRule = defs[k].getAttribute("creationRule");
                                if (creationRule != null) {
                                    es.setCreationrule(creationRule);
                                } else {
                                    es.setCreationrule("manual");
                                }
                                String hasNameCompartment = defs[k].getAttribute("hasNameCompartment");
                                if (hasNameCompartment != null) {
                                    if (hasNameCompartment.equalsIgnoreCase("true")) {
                                        es.setHasnamecompartment(true);
                                    } else
                                        es.setHasnamecompartment(false);
                                }

                                // setup element spec subtypes
                                String symbolType = defs[k].getAttribute("symbolType");
                                es.setSymboltype(symbolType);
                                if (symbolType.equalsIgnoreCase("connector")) {
                                    ConnectorSpecification_c cs = new ConnectorSpecification_c(
                                            graphicsModelRoot);
                                    cs.relateAcrossR200To(es);
                                }
                                // setup dependencies
                                addClientClassDependency(es, className);
                                IConfigurationElement[] depends = defs[k].getChildren("dependsOn");
                                for (int d = 0; d < depends.length; ++d) {
                                    addClientClassDependency(es, depends[d].getAttribute("class"));
                                }
                                // setup auto resize
                                String causeAutoResize = defs[k].getAttribute("causeAutoResize");
                                if (causeAutoResize != null) {
                                    if (causeAutoResize.equalsIgnoreCase("false")) {
                                        es.setCauseautoresize(false);
                                    }
                                } else {
                                    es.setCauseautoresize(true);
                                }
                            }
                        }
                    } // end if element name is Symbol
                }
                for (int k = 0; k < defs.length; k++) {
                    int value = 0;
                    if (defs[k].getName().equals("defaultFor")) {
                        String className = defs[k].getAttribute("class");
                        if (!className.equals("")) {
                            String mdlTypDef = defs[k].getAttribute("modelType");
                            String ooaTypDef = defs[k].getAttribute("ooaType");
                            if (mdlTypDef != null && !mdlTypDef.equals("")) {
                                int modelType = getValueFor(mdlTypDef);
                                int ooaType = getValueFor(ooaTypDef);
                                IConfigurationElement[] col = defs[k].getChildren("color");
                                int r = Integer.parseInt(col[0].getAttribute("r"));
                                int g = Integer.parseInt(col[0].getAttribute("g"));
                                int b = Integer.parseInt(col[0].getAttribute("b"));
                                String diagName = defs[k].getAttribute("name");
                                ModelSpecification_c ms = new ModelSpecification_c(graphicsModelRoot);
                                ms.setName(diagName);
                                ms.setModel_type(modelType);
                                ms.setOoa_type(ooaType);
                                String clrStr = Integer.toString(r) + "," + Integer.toString(g) + ","
                                        + Integer.toString(b);
                                String prefStr = "CanvasPreferencePage." + diagName + ".bkgColor";
                                prefStore.setDefault(prefStr, clrStr);
                                clrStr = prefStore.getString(prefStr);
                                if (clrStr == null || clrStr.equals("")) {
                                    // The preference is not set, set it to the default
                                    prefStore.setToDefault(prefStr);
                                    clrStr = prefStore.getString(prefStr);
                                }
                                ms.setBackground(parseColor(clrStr));
                                try {
                                    ms.setRepresents(Class.forName(className));
                                } catch (ClassNotFoundException e) {
                                    logError("Specified metamodel class not found: ", e);
                                }
                                IConfigurationElement[] symbols = defs[k].getChildren("validSymbol");
                                for (int m = 0; m < symbols.length; m++) {
                                    final String name = symbols[m].getAttribute("name");
                                    final String symbolClassName = symbols[m].getAttribute("class");
                                    String symbolOoaTypeDef = symbols[m].getAttribute("elemType");
                                    int symbolElemType = -1;
                                    if (symbolOoaTypeDef != null) {
                                        symbolElemType = getValueFor(symbolOoaTypeDef);
                                    }
                                    final int finalElemType = symbolElemType;
                                    ElementSpecification_c elem = ElementSpecification_c
                                            .ElementSpecificationInstance(graphicsModelRoot,
                                                    new ClassQueryInterface_c() {
                                                        public boolean evaluate(Object candidate) {
                                                            boolean result = false;
                                                            ElementSpecification_c elemSpec = (ElementSpecification_c) candidate;
                                                            if (elemSpec.getName().equals(name)) {
                                                                result = true;
                                                            }
                                                            if (finalElemType != -1) {
                                                                if (elemSpec.getOoa_type() == finalElemType)
                                                                    result = true;
                                                                else
                                                                    result = false;
                                                            }
                                                            if (symbolClassName != null) {
                                                                try {
                                                                    if (elemSpec.getRepresents() == Class
                                                                            .forName(symbolClassName)
                                                                            && elemSpec.getName()
                                                                                    .equals(name)) {
                                                                        result = true;
                                                                    } else {
                                                                        result = false;
                                                                    }
                                                                } catch (ClassNotFoundException e) {
                                                                    logError(
                                                                            "Specified metamodel class not found: ",
                                                                            e);
                                                                }
                                                            }
                                                            return result;
                                                        }
                                                    });
                                    if (elem != null) {
                                        // get the tool category from specification
                                        String toolCategory = symbols[m].getAttribute("tool_category");
                                        if (toolCategory != null) {
                                            elem.setToolcategory(toolCategory);
                                        }
                                        ElementInModelSpecification_c eims = new ElementInModelSpecification_c(
                                                graphicsModelRoot);
                                        ms.relateAcrossR11To(eims);
                                        elem.relateAcrossR11To(eims);
                                    }
                                }
                            }
                        }
                    }
                }
                for (int k = 0; k < defs.length; k++) {
                    if (defs[k].getName().equals("symbol")) {
                        final String finalName = defs[k].getAttribute("name");
                        String symTypDef = defs[k].getAttribute("elemType");
                        if (symTypDef != null) {
                            final int elemType = getValueFor(symTypDef);
                            ElementSpecification_c es = ElementSpecification_c.ElementSpecificationInstance(
                                    graphicsModelRoot, new ClassQueryInterface_c() {

                                        public boolean evaluate(Object candidate) {
                                            ElementSpecification_c es = (ElementSpecification_c) candidate;
                                            return es.getName().equals(finalName)
                                                    && es.getOoa_type() == elemType;
                                        }

                                    });
                            // setup element spec subtypes
                            String symbolType = defs[k].getAttribute("symbolType");
                            if (symbolType.equalsIgnoreCase("connector")) {
                                ConnectorSpecification_c cs = ConnectorSpecification_c.getOneTS_CSPOnR200(es);
                                IConfigurationElement[] terms = defs[k].getChildren("terminator");
                                for (int l = 0; l < terms.length; l++) {
                                    TerminalSpecification_c tms = new TerminalSpecification_c(
                                            graphicsModelRoot);
                                    tms.setName(terms[l].getAttribute("name"));
                                    boolean isStart = terms[l].getAttribute("end").equals("start");
                                    if (isStart) {
                                        cs.relateAcrossR202To(tms);
                                    } else {
                                        cs.relateAcrossR203To(tms);
                                    }
                                    final String symbol = terms[l].getAttribute("symbol");
                                    final String symbolClassName = terms[l].getAttribute("symbolClass");
                                    ElementSpecification_c els = ElementSpecification_c
                                            .ElementSpecificationInstance(graphicsModelRoot,
                                                    new ClassQueryInterface_c() {
                                                        public boolean evaluate(Object candidate) {
                                                            boolean result = false;
                                                            ElementSpecification_c elemSpec = (ElementSpecification_c) candidate;
                                                            if (elemSpec.getName().equals(symbol)) {
                                                                result = true;
                                                            }

                                                            if (symbolClassName != null) {
                                                                try {
                                                                    if (elemSpec.getRepresents() == Class
                                                                            .forName(symbolClassName)
                                                                            && (elemSpec.getName()
                                                                                    .equals(symbol))) {
                                                                        result = true;
                                                                    } else {
                                                                        result = false;
                                                                    }
                                                                } catch (ClassNotFoundException e) {
                                                                    logError(
                                                                            "Specified metamodel class not found: ",
                                                                            e);
                                                                }
                                                            }
                                                            return result;
                                                        }
                                                    });
                                    String type = terms[l].getAttribute("type");
                                    if (els != null) {
                                        if (type.equals("shape")) {
                                            ShapeTerminal_c sst = new ShapeTerminal_c(graphicsModelRoot);
                                            sst.relateAcrossR201To(tms);
                                            ShapeSpecification_c ss = ShapeSpecification_c
                                                    .getOneTS_SSPOnR200(els);
                                            if (ss != null) {
                                                sst.relateAcrossR204To(ss);
                                            }
                                        } else if (type.equals("connector")) {
                                            ConnectorTerminal_c cnt = new ConnectorTerminal_c(
                                                    graphicsModelRoot);
                                            cnt.relateAcrossR201To(tms);
                                            ConnectorSpecification_c cns = ConnectorSpecification_c
                                                    .getOneTS_CSPOnR200(els);
                                            if (cns != null) {
                                                cnt.relateAcrossR205To(cns);
                                                String terminatesAt = terms[l].getAttribute("terminatesAt");
                                                if (terminatesAt.equals("start")) {
                                                    cnt.setTerminatesat(End_c.Start);
                                                } else if (terminatesAt.equals("middle")) {
                                                    cnt.setTerminatesat(End_c.Middle);
                                                } else if (terminatesAt.equals("end")) {
                                                    cnt.setTerminatesat(End_c.End);
                                                }
                                            }
                                        }
                                    } else if (type.equals("whitespace")) {
                                        WhitespaceTerminal_c wst = new WhitespaceTerminal_c(graphicsModelRoot);
                                        wst.relateAcrossR201To(tms);
                                    }
                                    IConfigurationElement[] automaticCreations = terms[l]
                                            .getChildren("automaticCreation");
                                    for (IConfigurationElement automaticCreation : automaticCreations) {
                                        final String creationSymbol = automaticCreation.getAttribute("symbol");
                                        final String creationSymbolClassName = automaticCreation
                                                .getAttribute("symbolClass");
                                        els = ElementSpecification_c.ElementSpecificationInstance(
                                                graphicsModelRoot, new ClassQueryInterface_c() {
                                                    public boolean evaluate(Object candidate) {
                                                        boolean result = false;
                                                        ElementSpecification_c elemSpec = (ElementSpecification_c) candidate;
                                                        if (elemSpec.getName().equals(creationSymbol)) {
                                                            result = true;
                                                        }

                                                        if (creationSymbolClassName != null) {
                                                            try {
                                                                if (elemSpec.getRepresents() == Class
                                                                        .forName(creationSymbolClassName)
                                                                        && (elemSpec.getName()
                                                                                .equals(creationSymbol))) {
                                                                    result = true;
                                                                } else {
                                                                    result = false;
                                                                }
                                                            } catch (ClassNotFoundException e) {
                                                                logError(
                                                                        "Specified metamodel class not found: ",
                                                                        e);
                                                            }
                                                        }
                                                        return result;
                                                    }
                                                });
                                        if (els != null) {
                                            tms.relateAcrossR209To(els);
                                        }
                                    }
                                }
                            } else if (symbolType.equalsIgnoreCase("shape")) {
                                ShapeSpecification_c ss = new ShapeSpecification_c(graphicsModelRoot);
                                ss.relateAcrossR200To(es);

                                NoncontainingShapeSpecification_c ncss = new NoncontainingShapeSpecification_c(
                                        graphicsModelRoot);
                                ncss.relateAcrossR208To(ss);
                            } else if (symbolType.equalsIgnoreCase("container")) {
                                ShapeSpecification_c ss = new ShapeSpecification_c(graphicsModelRoot);
                                ss.relateAcrossR200To(es);

                                ContainingShapeSpecification_c css = new ContainingShapeSpecification_c(
                                        graphicsModelRoot);
                                css.relateAcrossR208To(ss);
                            }
                        }
                    }
                }
            }
        }
    } // end for all extensions
      // Auto reconcile instance left until last to ensure that all
      // symbol specifications that might be referenced are created

    // Here to set the association between ARS and the ES //

    for (int i = 0; i < exts.length; i++) {
        IConfigurationElement[] elems = exts[i].getConfigurationElements();
        for (int j = 0; j < elems.length; j++) {
            if (elems[j].getName().equals("editor")) { //$NON-NLS-1$
                IConfigurationElement[] defs = elems[j].getChildren();
                for (int k = 0; k < defs.length; k++) {
                    if (defs[k].getName().equals("symbol")) {
                        // setup autoReconcile
                        IConfigurationElement[] autoReconcile = defs[k].getChildren("autoReconcile");
                        for (int e = 0; e < autoReconcile.length; ++e) {
                            AutoReconciliationSpecification_c ars = new AutoReconciliationSpecification_c(
                                    graphicsModelRoot);
                            ars.setName(autoReconcile[e].getAttribute("name"));
                            ars.setCountmethod(autoReconcile[e].getAttribute("countMethod"));
                            ars.setElementmethod(autoReconcile[e].getAttribute("elementMethod"));
                            ars.setElementexistsmethod(autoReconcile[e].getAttribute("elementExistsMethod"));
                            ars.setTemplateelementmethod(
                                    autoReconcile[e].getAttribute("templateElementMethod"));
                            if (ars.getTemplateelementmethod() == null) {
                                ars.setTemplateelementmethod("");
                            }
                            ElementSpecification_c scanTarget = locateEsByNameAndClassType(graphicsModelRoot,
                                    defs[k].getAttribute("name"), defs[k].getAttribute("class"));
                            ars.relateAcrossR29To(scanTarget);
                            ElementSpecification_c targetSymbol = locateEsByNameAndClassType(graphicsModelRoot,
                                    autoReconcile[e].getAttribute("targetSymbol"), null);
                            ars.relateAcrossR31To(targetSymbol);
                            String ssSpec = autoReconcile[e].getAttribute("sourceSymbol");
                            if (ssSpec != null) {
                                ars.relateAcrossR30To(
                                        locateEsByNameAndClassType(graphicsModelRoot, ssSpec, null));
                            } else {
                                ars.relateAcrossR30To(targetSymbol);
                            }
                        }

                    }

                    else if (defs[k].getName().equals("defaultFor")) {
                        // setup autoReconcile
                        IConfigurationElement[] autoReconcile = defs[k].getChildren("autoReconcile");
                        for (int e = 0; e < autoReconcile.length; ++e) {
                            AutoReconciliationSpecification_c ars = new AutoReconciliationSpecification_c(
                                    graphicsModelRoot);
                            ars.setName(autoReconcile[e].getAttribute("name"));
                            ars.setCountmethod(autoReconcile[e].getAttribute("countMethod"));
                            ars.setElementmethod(autoReconcile[e].getAttribute("elementMethod"));
                            ars.setElementexistsmethod(autoReconcile[e].getAttribute("elementExistsMethod"));
                            ars.setTemplateelementmethod(
                                    autoReconcile[e].getAttribute("templateElementMethod"));
                            if (ars.getTemplateelementmethod() == null) {
                                ars.setTemplateelementmethod("");
                            }
                            // ElementSpecification_c scanTarget = locateEsByNameAndClassType(
                            //graphicsModelRoot, defs[k].getAttribute("name"), defs[k].getAttribute("class")); 
                            ModelSpecification_c modelSpec = locateMesByNameAndClassType(graphicsModelRoot,
                                    defs[k].getAttribute("name"), defs[k].getAttribute("class"));
                            ars.relateAcrossR33To(modelSpec);
                            ElementSpecification_c targetSymbol = locateEsByNameAndClassType(graphicsModelRoot,
                                    autoReconcile[e].getAttribute("targetSymbol"),
                                    autoReconcile[e].getAttribute("class"));
                            ars.relateAcrossR31To(targetSymbol);
                            String ssSpec = autoReconcile[e].getAttribute("sourceSymbol");
                            if (ssSpec != null) {
                                ars.relateAcrossR30To(
                                        locateEsByNameAndClassType(graphicsModelRoot, ssSpec, null));
                            } else {
                                ars.relateAcrossR30To(targetSymbol);
                            }
                        }
                    }
                }
            }
        }
    }
}

From source file:com.microsoft.tfs.client.common.ui.prefs.UIPreferenceInitializer.java

License:Open Source License

@Override
public void initializeDefaultPreferences() {
    final IPreferenceStore prefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();

    prefs.setDefault(UIPreferenceConstants.RECONNECT_AT_STARTUP, true);
    prefs.setDefault(UIPreferenceConstants.CONNECT_MAPPED_PROJECTS_AT_IMPORT, true);
    prefs.setDefault(UIPreferenceConstants.ACCEPT_UNTRUSTED_CERTIFICATES, false);
    prefs.setDefault(UIPreferenceConstants.EMBEDDED_WEB_BROWSER_TYPE, SWT.NONE);

    // default lock level for automatic checkout from edits, and default in
    // the checkout dialog
    // default for orcas: lock level is "unchanged"
    prefs.setDefault(UIPreferenceConstants.CHECKOUT_LOCK_LEVEL,
            UIPreferenceConstants.CHECKOUT_LOCK_LEVEL_UNCHANGED);

    prefs.setDefault(UIPreferenceConstants.WIT_DOUBLE_CLICK_FILE_ATTACHMENT,
            UIPreferenceConstants.WIT_DOUBLE_CLICK_FILE_ATTACHMENT_LAUNCH_BROWSER);

    prefs.setDefault(UIPreferenceConstants.SYNC_DECORATE, true);
    prefs.setDefault(UIPreferenceConstants.SYNC_REFRESH_LOCAL, false);
    prefs.setDefault(UIPreferenceConstants.SYNC_REFRESH_REMOTE, false);
    prefs.setDefault(UIPreferenceConstants.SYNC_REFRESH_REMOTE_INTERVAL, 3600);

    prefs.setDefault(UIPreferenceConstants.LABEL_DECORATION_DECORATE_FOLDERS, false);
    prefs.setDefault(UIPreferenceConstants.LABEL_DECORATION_SHOW_CHANGESET, true);
    prefs.setDefault(UIPreferenceConstants.LABEL_DECORATION_SHOW_SERVER_ITEM, false);
    prefs.setDefault(UIPreferenceConstants.LABEL_DECORATION_SHOW_IGNORED_STATUS, true);

    prefs.setDefault(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS, true);
    prefs.setDefault(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED, true);
    prefs.setDefault(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE, true);

    prefs.setDefault(UIPreferenceConstants.GATED_CONFIRMATION_PRESERVE_PENDING_CHANGES, true);

    prefs.setDefault(UIPreferenceConstants.WORK_ITEM_EDITOR_ID,
            WorkItemEditorHelper.EMBEDDED_WEB_ACCESS_EDITOR_ID);

    prefs.setDefault(UIPreferenceConstants.DETECT_LOCAL_CHANGES_ON_MANUAL_RECONNECT, true);
    prefs.setDefault(UIPreferenceConstants.DETECT_LOCAL_CHANGES_ON_AUTOMATIC_RECONNECT, true);

    prefs.setDefault(UIPreferenceConstants.RECONNECT_PROJECTS_TO_NEW_REPOSITORIES, false);

    prefs.setDefault(UIPreferenceConstants.CONSOLE_SHOW_ON_NEW_MESSAGE, false);
    prefs.setDefault(UIPreferenceConstants.CONSOLE_SHOW_ON_NEW_WARNING, true);
    prefs.setDefault(UIPreferenceConstants.CONSOLE_SHOW_ON_NEW_ERROR, true);

    prefs.setDefault(UIPreferenceConstants.AUTO_RESOLVE_CONFLICTS, true);
}

From source file:com.mindquarry.desktop.preferences.pages.TaskPage.java

License:Open Source License

/**
 * {@inheritDoc}/* w  ww.j ava  2  s .c o  m*/
 * 
 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
 */
@Override
protected void createFieldEditors() {
    IPreferenceStore store = getPreferenceStore();
    store.setDefault(LIST_FINISHED_TASKS, false);

    BooleanFieldEditor showFinishedTasks = new BooleanFieldEditor(LIST_FINISHED_TASKS, "&" //$NON-NLS-1$
            + I18N.get("List finished tasks"), //$NON-NLS-1$
            getFieldEditorParent());
    addField(showFinishedTasks);
}