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

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

Introduction

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

Prototype

String STRING_DEFAULT_DEFAULT

To view the source code for org.eclipse.jface.preference IPreferenceStore STRING_DEFAULT_DEFAULT.

Click Source Link

Document

The default-default value for String preferences ("").

Usage

From source file:org.eclipse.rap.interactiondesign.tests.LayoutRegistryTest.java

License:Open Source License

public void testSaveLayoutId() {
    String savedLayoutId = registry.getSavedLayoutId();
    String defaultString = IPreferenceStore.STRING_DEFAULT_DEFAULT;
    assertEquals(defaultString, savedLayoutId);
    Layout activeLayout = registry.getActiveLayout();
    String id = "";
    if (activeLayout.getId().equals(LAYOUT_ID)) {
        registry.setActiveLayout(LAYOUT_ID2, true);
        id = LAYOUT_ID2;/*  w w  w  .j a v a 2s .com*/
    } else {
        registry.setActiveLayout(LAYOUT_ID, true);
        id = LAYOUT_ID;
    }
    savedLayoutId = registry.getSavedLayoutId();
    assertEquals(id, savedLayoutId);
    registry.saveLayoutId(defaultString);
    savedLayoutId = registry.getSavedLayoutId();
    assertEquals(defaultString, savedLayoutId);
    registry.saveLayoutId(id);
    savedLayoutId = registry.getSavedLayoutId();
    assertEquals(id, savedLayoutId);
    registry.saveLayoutId(defaultString);
}

From source file:org.eclipse.rap.ui.interactiondesign.ConfigurableStack.java

License:Open Source License

/**
 * Loads the saved <code>ConfigurableStack</code> id from the preferences
 * store using a specific <code>IStackPresentationSite</code>. This id is
 * needed to instantiate the <code>ConfigurableStack</code> for a specific
 * LayoutPart./* ww w.  j  av  a  2 s.c om*/
 *
 * @param site an instance of <code>IStackPreentationSite</code>.
 *
 * @return the saved <code>ConfigurableStack</code> id for the part
 * represented by the <code>IStackPresentationSite</code> or <code>null</code>
 * if no id is saved.
 *
 * @see LayoutPart
 * @see IStackPresentationSite
 */
public static String getSavedStackId(final IStackPresentationSite site) {
    String layoutPartId = null;
    String result = IPreferenceStore.STRING_DEFAULT_DEFAULT;

    layoutPartId = getLayoutPartId(site);

    if (layoutPartId != null) {
        ScopedPreferenceStore prefStore = (ScopedPreferenceStore) PrefUtil.getAPIPreferenceStore();
        String stackPresentationId = ConfigurableStackProxy.STACK_PRESENTATION_ID;
        String stackPresentationKey = stackPresentationId + "/" + layoutPartId;
        result = prefStore.getString(stackPresentationKey);
    }

    return result;
}

From source file:org.eclipse.rap.ui.interactiondesign.ConfigurableStack.java

License:Open Source License

/**
 * Returns an instance of <code>{@link ConfigurationAction}</code> for this
 * <code>ConfigurableStack</code> object, which is declared over the same
 * extension.//from ww  w.j a  v  a  2s .  c o  m
 *
 * @return the <code>ConfigurationAction</code> or <code>null</code> if no
 * action is declared for the id holding by this object.
 *
 * @see ConfigurationAction
 */
public ConfigurationAction getConfigAction() {
    ConfigurationAction result = null;
    if (configAction == null) {
        if (stackPresentationId != null && !stackPresentationId.equals("")) {
            IExtensionRegistry registry = Platform.getExtensionRegistry();
            String stackId = STACK_PRESENTATION_EXT_ID;
            IExtensionPoint point = registry.getExtensionPoint(stackId);

            if (point != null) {
                IConfigurationElement[] elements = point.getConfigurationElements();
                String defaultValue = IPreferenceStore.STRING_DEFAULT_DEFAULT;
                String actionClass = defaultValue;

                boolean breakValue = true;
                IConfigurationElement element = null;
                ImageDescriptor imageDesc = null;
                for (int i = 0; breakValue && i < elements.length; i++) {
                    String id = elements[i].getAttribute("id");
                    if (id.equals(stackPresentationId)) {
                        actionClass = elements[i].getAttribute(CONFIG_ACTION_NAME);
                        if (actionClass != null && !actionClass.equals(defaultValue)) {
                            breakValue = false;
                            element = elements[i];
                            String actionImage = element.getAttribute("actionIcon");
                            String menuImage = element.getAttribute("menuIcon");
                            String contributerId = element.getContributor().getName();
                            if (actionImage != null) {
                                imageDesc = AbstractUIPlugin.imageDescriptorFromPlugin(contributerId,
                                        actionImage);
                            }
                            if (menuImage != null) {
                                menuIcon = AbstractUIPlugin.imageDescriptorFromPlugin(contributerId, menuImage);
                            }
                        }
                    }
                }

                String defaultStore = defaultValue;
                if (actionClass != null && !actionClass.equals(defaultStore) && element != null) {
                    try {
                        Object obj = element.createExecutableExtension(CONFIG_ACTION_NAME);
                        if (obj instanceof ConfigurationAction) {
                            configAction = (ConfigurationAction) obj;
                            configAction.init(getSite(), this);
                            if (imageDesc != null) {
                                configAction.setImageDescriptor(imageDesc);
                            }
                        }
                    } catch (CoreException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
    result = configAction;
    return result;
}

From source file:org.eclipse.rap.ui.interactiondesign.internal.ConfigurableStackProxy.java

License:Open Source License

private ConfigurableStack loadStackPresentations(final String type, final IStackPresentationSite site,
        final Composite parent) {
    this.parent = parent;
    ConfigurableStack result = null;/*from w  ww .ja  va  2s . c o  m*/
    IExtensionRegistry registry = Platform.getExtensionRegistry();
    String stackPresentationExtId = ConfigurableStack.STACK_PRESENTATION_EXT_ID;
    IExtensionPoint point = registry.getExtensionPoint(stackPresentationExtId);
    if (point != null) {
        IConfigurationElement[] elements = point.getConfigurationElements();

        String savedStackId = ConfigurableStack.getSavedStackId(site);

        boolean error = false;
        boolean found = false;
        for (int i = 0; !error && !found && i < elements.length; i++) {

            String id = elements[i].getAttribute("id");
            String presentationType = elements[i].getAttribute("type");

            if (savedStackId.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT)) {
                // No id is saved, check branding Presentationfactory
                if (brandingPresentationFactoryExists()) {
                    ConfigurableStack tempStack = loadStackFromBranding();
                    if (tempStack != null) {
                        result = tempStack;
                        currentId = id;
                    } else {
                        result = null;
                    }
                    found = true;
                } else {
                    result = null;
                    found = true;
                }

            } else {
                // their is a saved id, loading the stackPresentation if the id 
                // matches the saved id
                if (id.equals(savedStackId) && presentationType.equals(type)) {
                    result = createStackById(id);
                    currentId = id;
                    found = true;
                }
            }

        }
    }
    return result;
}

From source file:org.eclipse.rap.ui.interactiondesign.layout.ElementBuilder.java

License:Open Source License

/**
 * This constructor stores the parent composite and instantiate a
 * <code>{@link LayoutSet}</code> for this instance. The <code>LayoutSet
 * </code> can be used to create images, fonts, colors or postion data.
 * This depends on what is defined for a specific builder.
 * <p>//from   w  ww .  j  a  v  a2 s  . c o m
 * Subclasses have to call this constructor because it register the object
 * in the <code>{@link LayoutRegistry}</code>
 * </p>
 *
 * @param parent the parent <code>{@link Composite}</code> for the component
 * to build.
 * @param layoutSetId the id of the <code>LayoutSet</code>, which belongs to
 * this instance.
 *
 * @see LayoutSet
 * @see LayoutRegistry#registerBuilder(ElementBuilder)
 * @see Composite
 */
public ElementBuilder(final Composite parent, final String layoutSetId) {
    this.parent = parent;
    LayoutRegistry registry = LayoutRegistry.getInstance();
    String savedLayoutId = registry.getSavedLayoutId();
    if (!savedLayoutId.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT)) {
        registry.setActiveLayout(savedLayoutId, false);
    }
    layout = registry.getActiveLayout();
    if (layout != null) {
        layoutSet = layout.getLayoutSet(layoutSetId);
        registry.registerBuilder(this);
    } else {
        String msg = "no layout registered with default "
                + "id (LayoutRegistry.DEFAULT_LAYOUT_ID) or no layout activated " + "over branding extension.";
        throw new IllegalArgumentException(msg);
    }
}

From source file:org.eclipse.rap.ui.interactiondesign.layout.LayoutRegistry.java

License:Open Source License

/**
 * Reads the saved <code>Layout</code> id from a <code>ScopedPreferenceStore
 * </code>.//from w  w  w  . j a va  2  s.  co  m
 * 
 * @return the saved <code>Layout</code> id or 
 * <code>{@link IPreferenceStore#STRING_DEFAULT_DEFAULT}</code> if no id is 
 * saved.
 */
public String getSavedLayoutId() {
    String result = IPreferenceStore.STRING_DEFAULT_DEFAULT;
    IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore();
    result = preferenceStore.getString(SAVED_LAYOUT_KEY);
    return result;
}

From source file:org.eclipse.ui.ide.markers.compatibility.internal.CachedMarkerBuilder.java

License:Open Source License

/**
 * Load the filters defined in memento string.
 * /*from   www . j  a v  a  2  s .c om*/
 * @param mementoString
 */
private void loadFiltersFrom(String mementoString) {
    if (mementoString.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT))
        return;

    try {
        loadFilterSettings(XMLMemento.createReadRoot(new StringReader(mementoString)));
    } catch (WorkbenchException e) {
        StatusManager.getManager().handle(e.getStatus());
    }
}

From source file:org.eclipse.ui.ide.markers.compatibility.internal.CachedMarkerBuilder.java

License:Open Source License

/**
 * Load the pre-3.4 filters./*w w  w.  j  av a 2s.  c  o  m*/
 * 
 * @param mementoString
 */
private void loadLegacyFiltersFrom(String mementoString) {

    if (mementoString.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT))
        return;
    IMemento memento;
    try {
        memento = XMLMemento.createReadRoot(new StringReader(mementoString));
        restoreLegacyFilters(memento);
    } catch (WorkbenchException e) {
        StatusManager.getManager().handle(e.getStatus());
        return;
    }

}

From source file:org.eclipse.ui.internal.views.markers.MarkerContentGenerator.java

License:Open Source License

/**
 * Load the filters defined in memento string.
 * // ww w.  ja  v a  2  s .c o m
 * @param mementoString
 */
private void loadFiltersFrom(String mementoString) {
    if (mementoString.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT))
        return;

    try {
        XMLMemento root = XMLMemento.createReadRoot(new StringReader(mementoString));
        loadLimitSettings(root);
        loadFilterSettings(root);
    } catch (WorkbenchException e) {
        StatusManager.getManager().handle(e.getStatus());
    }
}

From source file:org.eclipse.ui.views.markers.internal.MarkerView.java

License:Open Source License

/**
 * Load the filters preference./*ww  w . j  a va 2  s  . c o m*/
 */
private void loadFiltersPreferences() {

    String preference = IDEWorkbenchPlugin.getDefault().getPreferenceStore()
            .getString(getFiltersPreferenceName());

    if (preference.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT)) {
        createDefaultFilter();
        return;
    }

    StringReader reader = new StringReader(preference);
    try {
        restoreFilters(XMLMemento.createReadRoot(reader));
    } catch (WorkbenchException e) {
        IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e);
    }

}