diff options
| author | Kevin Sawicki | 2011-04-13 23:38:14 +0000 |
|---|---|---|
| committer | Chris Aniszczyk | 2011-04-14 15:04:52 +0000 |
| commit | 1e11979bbbe8340b309e985dbd8941c6feb0c0ae (patch) | |
| tree | 5d78ebe5b043322c06efc9caad3e9cd4e6725669 | |
| parent | 7b0fcb59931fca160761504e374543c3ad5160a8 (diff) | |
| download | egit-github-1e11979bbbe8340b309e985dbd8941c6feb0c0ae.tar.gz egit-github-1e11979bbbe8340b309e985dbd8941c6feb0c0ae.tar.xz egit-github-1e11979bbbe8340b309e985dbd8941c6feb0c0ae.zip | |
Add initial gist task attributes
Change-Id: I35e1aabd8e2df7fd9982bf44ebee1424cd668691
Signed-off-by: Kevin Sawicki <kevin@github.com>
Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
3 files changed, 189 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java new file mode 100644 index 00000000..642d14a8 --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java @@ -0,0 +1,136 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.internal.github.core.gist; + +import org.eclipse.mylyn.tasks.core.data.TaskAttribute; +import org.eclipse.mylyn.tasks.core.data.TaskData; + +/** + * Gist task attribute enumeration. + */ +public enum GistAttribute { + + /** + * Gist key + */ + KEY(TaskAttribute.TASK_KEY, Messages.GistAttribute_LabelKey, + TaskAttribute.TYPE_SHORT_TEXT, true), + + /** + * Gist author + */ + AUTHOR(TaskAttribute.USER_REPORTER, Messages.GistAttribute_LabelAuthor, + TaskAttribute.TYPE_PERSON, TaskAttribute.KIND_PEOPLE, true), + + /** + * Gist created date + */ + CREATED(TaskAttribute.DATE_CREATION, Messages.GistAttribute_LabelCreated, + TaskAttribute.TYPE_DATETIME, true), + + /** + * Comment being added to gist + */ + COMMENT_NEW(TaskAttribute.COMMENT_NEW, + Messages.GistAttribute_LabelNewComment, + TaskAttribute.TYPE_LONG_RICH_TEXT, false), + + /** + * URL + */ + URL(TaskAttribute.TASK_URL, Messages.GistAttribute_LabelUrl, + TaskAttribute.TYPE_URL, true), + + /** + * Gist description + */ + DESCRIPTION(TaskAttribute.DESCRIPTION, + Messages.GistAttribute_LabelDescription, + TaskAttribute.TYPE_LONG_RICH_TEXT, false); + + private String id; + private String label; + private String type; + private String kind; + private boolean readOnly; + + private GistAttribute(String id, String label, String type, boolean readOnly) { + this(id, label, TaskAttribute.KIND_DEFAULT, type, readOnly); + } + + private GistAttribute(String id, String label, String kind, String type, + boolean readOnly) { + this.id = id; + this.label = label; + this.kind = kind; + this.type = type; + this.readOnly = readOnly; + } + + /** + * @return id + */ + public String getId() { + return this.id; + } + + /** + * @return label + */ + public String getLabel() { + return this.label; + } + + /** + * @return type + */ + public String getType() { + return this.type; + } + + /** + * @return kind + */ + public String getKind() { + return this.kind; + } + + /** + * @return readOnly + */ + public boolean isReadOnly() { + return this.readOnly; + } + + /** + * Create task attribute under root of task data + * + * @param data + * @return created attribute + */ + public TaskAttribute create(TaskData data) { + return create(data.getRoot()); + } + + /** + * Create task attribute under parent + * + * @param parent + * @return created attribute + */ + public TaskAttribute create(TaskAttribute parent) { + TaskAttribute attribute = new TaskAttribute(parent, this.id); + attribute.getMetaData().defaults().setLabel(this.label) + .setType(this.type).setKind(this.kind) + .setReadOnly(this.readOnly); + return attribute; + } +} diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java new file mode 100644 index 00000000..b7127ffa --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2011 GitHub Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Kevin Sawicki (GitHub Inc.) - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.internal.github.core.gist; + +import org.eclipse.osgi.util.NLS; + +/** + * NLS for Mylyn GitHub Core + */ +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.github.core.gist.messages"; //$NON-NLS-1$ + + /** */ + public static String GistAttribute_LabelAuthor; + + /** */ + public static String GistAttribute_LabelCreated; + + /** */ + public static String GistAttribute_LabelDescription; + + /** */ + public static String GistAttribute_LabelKey; + + /** */ + public static String GistAttribute_LabelNewComment; + + /** */ + public static String GistAttribute_LabelUrl; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties new file mode 100644 index 00000000..04cf280c --- /dev/null +++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties @@ -0,0 +1,6 @@ +GistAttribute_LabelAuthor=Author: +GistAttribute_LabelCreated=Created: +GistAttribute_LabelDescription=Description: +GistAttribute_LabelKey=Key +GistAttribute_LabelNewComment=New Comment +GistAttribute_LabelUrl=Url |
