Search in sources :

Example 36 with TaskAttribute

use of org.eclipse.mylyn.tasks.core.data.TaskAttribute in project linuxtools by eclipse.

the class OSIORestSearchQueryPage method restoreStateFromUrl.

private void restoreStateFromUrl(String queryUrl) throws UnsupportedEncodingException {
    // $NON-NLS-1$
    queryUrl = queryUrl.substring(queryUrl.indexOf("?") + 1);
    // $NON-NLS-1$
    String[] options = queryUrl.split("&");
    for (String option : options) {
        String key;
        // $NON-NLS-1$
        int endindex = option.indexOf("=");
        if (endindex == -1) {
            key = null;
        } else {
            // $NON-NLS-1$
            key = option.substring(0, option.indexOf("="));
        }
        if (key == null || key.equals("order")) {
            // $NON-NLS-1$
            continue;
        }
        String value = // $NON-NLS-1$
        URLDecoder.decode(// $NON-NLS-1$
        option.substring(option.indexOf("=") + 1), getTaskRepository().getCharacterEncoding());
        TaskAttribute attr = getTargetTaskData().getRoot().getAttribute(key);
        if (attr != null) {
            if (getTargetTaskData().getRoot().getAttribute(key).getValue().equals("")) {
                // $NON-NLS-1$
                getTargetTaskData().getRoot().getAttribute(key).setValue(value);
            } else {
                getTargetTaskData().getRoot().getAttribute(key).addValue(value);
            }
        }
    }
}
Also used : TaskAttribute(org.eclipse.mylyn.tasks.core.data.TaskAttribute)

Aggregations

TaskAttribute (org.eclipse.mylyn.tasks.core.data.TaskAttribute)36 OSIORestClient (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestClient)13 TaskData (org.eclipse.mylyn.tasks.core.data.TaskData)13 TestData (org.eclipse.linuxtools.mylyn.osio.rest.test.support.TestData)12 Test (org.junit.Test)12 AbstractTaskDataHandler (org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler)11 TaskAttributeMapper (org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper)11 NullOperationMonitor (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.NullOperationMonitor)10 OSIORestConfiguration (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestConfiguration)10 RepositoryLocation (org.eclipse.mylyn.commons.repositories.core.RepositoryLocation)10 FileReader (java.io.FileReader)7 OSIORestTaskSchema (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestTaskSchema)5 TaskAttributeMetaData (org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData)5 JsonWriter (com.google.gson.stream.JsonWriter)3 StringWriter (java.io.StringWriter)3 ArrayList (java.util.ArrayList)3 LinkedHashSet (java.util.LinkedHashSet)3 TreeSet (java.util.TreeSet)3 Space (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.response.data.Space)3 TaskCommentMapper (org.eclipse.mylyn.tasks.core.data.TaskCommentMapper)3