aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-13 19:38:14 (EDT)
committerChris Aniszczyk2011-04-14 11:04:52 (EDT)
commit1e11979bbbe8340b309e985dbd8941c6feb0c0ae (patch)
tree5d78ebe5b043322c06efc9caad3e9cd4e6725669
parent7b0fcb59931fca160761504e374543c3ad5160a8 (diff)
downloadegit-github-1e11979bbbe8340b309e985dbd8941c6feb0c0ae.zip
egit-github-1e11979bbbe8340b309e985dbd8941c6feb0c0ae.tar.gz
egit-github-1e11979bbbe8340b309e985dbd8941c6feb0c0ae.tar.bz2
Add initial gist task attributesrefs/changes/02/3102/2
Change-Id: I35e1aabd8e2df7fd9982bf44ebee1424cd668691 Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/GistAttribute.java136
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/Messages.java47
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/internal/github/core/gist/messages.properties6
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 0000000..642d14a
--- /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 0000000..b7127ff
--- /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 0000000..04cf280
--- /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