use of org.eclipse.wst.sse.core.internal.provisional.tasks.TaskTag in project webtools.sourceediting by eclipse.
the class MainTab method removeTags.
/**
* @param selection
*/
private void removeTags(ISelection selection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
List taskTags = new ArrayList(Arrays.asList(fTaskTags));
taskTags.removeAll(structuredSelection.toList());
fTaskTags = (TaskTag[]) taskTags.toArray(new TaskTag[taskTags.size()]);
valueTable.setInput(fTaskTags);
}
use of org.eclipse.wst.sse.core.internal.provisional.tasks.TaskTag in project webtools.sourceediting by eclipse.
the class MainTab method addTag.
private void addTag() {
TaskTagDialog dlg = new TaskTagDialog(fControl.getShell());
int result = dlg.open();
if (result == Window.OK) {
TaskTag newTag = dlg.taskTag;
List newTags = new ArrayList(Arrays.asList(fTaskTags));
newTags.add(newTag);
fTaskTags = (TaskTag[]) newTags.toArray(new TaskTag[newTags.size()]);
valueTable.setInput(fTaskTags);
valueTable.getTable().setSelection(fTaskTags.length - 1);
}
}
use of org.eclipse.wst.sse.core.internal.provisional.tasks.TaskTag in project webtools.sourceediting by eclipse.
the class MainTab method loadTagsAndPrioritiesFrom.
/**
* @param tags
* @param priorities
*/
private void loadTagsAndPrioritiesFrom(String tagString, String priorityString) {
String[] tags = StringUtils.unpack(tagString);
StringTokenizer toker = null;
List list = new ArrayList();
// $NON-NLS-1$
toker = new StringTokenizer(priorityString, ",");
while (toker.hasMoreTokens()) {
Integer number = null;
try {
number = Integer.valueOf(toker.nextToken());
} catch (NumberFormatException e) {
number = new Integer(IMarker.PRIORITY_NORMAL);
}
list.add(number);
}
Integer[] priorities = (Integer[]) list.toArray(new Integer[0]);
fTaskTags = new TaskTag[Math.min(tags.length, priorities.length)];
for (int i = 0; i < fTaskTags.length; i++) {
fTaskTags[i] = new TaskTag(tags[i], priorities[i].intValue());
}
}
use of org.eclipse.wst.sse.core.internal.provisional.tasks.TaskTag in project webtools.sourceediting by eclipse.
the class WorkspaceTaskScanner method init.
private boolean init(IResource resource) {
IProject project = getProject(resource);
IPreferencesService preferencesService = Platform.getPreferencesService();
IScopeContext[] lookupOrder = new IScopeContext[] { new ProjectScope(project), new InstanceScope(), new DefaultScope() };
boolean proceed = preferencesService.getBoolean(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, lookupOrder);
if (Logger.DEBUG_TASKSPREFS) {
// $NON-NLS-1$ //$NON-NLS-2$
System.out.println(getClass().getName() + " scan of " + resource.getFullPath() + ":" + proceed);
}
if (proceed) {
String[] tags = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_TAGS, null, lookupOrder));
String[] priorities = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_PRIORITIES, null, lookupOrder));
String[] currentIgnoreContentTypeIDs = StringUtils.unpack(preferencesService.getString(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_CONTENTTYPES_IGNORED, null, lookupOrder));
if (Logger.DEBUG_TASKSPREFS) {
// $NON-NLS-1$
System.out.print(getClass().getName() + " tags: ");
for (int i = 0; i < tags.length; i++) {
if (i > 0) {
// $NON-NLS-1$
System.out.print(",");
}
System.out.print(tags[i]);
}
System.out.println();
// $NON-NLS-1$
System.out.print(getClass().getName() + " priorities: ");
for (int i = 0; i < priorities.length; i++) {
if (i > 0) {
// $NON-NLS-1$
System.out.print(",");
}
System.out.print(priorities[i]);
}
System.out.println();
// $NON-NLS-1$
System.out.print(getClass().getName() + " ignored content types: ");
for (int i = 0; i < currentIgnoreContentTypeIDs.length; i++) {
if (i > 0) {
// $NON-NLS-1$
System.out.print(",");
}
System.out.print(currentIgnoreContentTypeIDs[i]);
}
System.out.println();
}
fCurrentIgnoreContentTypes = new IContentType[currentIgnoreContentTypeIDs.length];
IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
for (int i = 0; i < currentIgnoreContentTypeIDs.length; i++) {
fCurrentIgnoreContentTypes[i] = contentTypeManager.getContentType(currentIgnoreContentTypeIDs[i]);
}
int max = Math.min(tags.length, priorities.length);
fCurrentTaskTags = new TaskTag[max];
for (int i = 0; i < max; i++) {
int priority = TaskTag.PRIORITY_NORMAL;
try {
priority = Integer.parseInt(priorities[i]);
} catch (NumberFormatException e) {
// default to normal priority
}
fCurrentTaskTags[i] = new TaskTag(tags[i], priority);
}
}
return proceed;
}
Aggregations