org.eclipse.xtext.tasks.Priority Java Examples

The following examples show how to use org.eclipse.xtext.tasks.Priority. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public String getColumnText(Object element, int columnIndex) {
	TaskTag task = (TaskTag) element;
	if (columnIndex == 0) {
		return task.getName();
	} else {
		if (Priority.HIGH == task.getPriority()) {
			return PreferencesMessages.TaskTagConfigurationBlock_markers_tasks_high_priority;
		} else if (Priority.NORMAL == task.getPriority()) {
			return PreferencesMessages.TaskTagConfigurationBlock_markers_tasks_normal_priority;
		} else if (Priority.LOW == task.getPriority()) {
			return PreferencesMessages.TaskTagConfigurationBlock_markers_tasks_low_priority;
		}
		return "";
	}
}
 
Example #2
Source File: TaskTagInputDialog.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public TaskTag getResult() {
	TaskTag task = new TaskTag();
	task.setName(nameField.getText().trim());
	switch (priorityField.getSelectionIndex()) {
		case 0:
			task.setPriority(Priority.HIGH);
			break;
		case 1:
			task.setPriority(Priority.NORMAL);
			break;
		default:
			task.setPriority(Priority.LOW);
			break;
	}
	return task;
}
 
Example #3
Source File: DefaultTaskParserTest.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testCaseInSensitive() {
  this.definitions.setCaseSensitive(false);
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("/*");
  _builder.newLine();
  _builder.append(" ");
  _builder.append("* FixMe case insensitive match");
  _builder.newLine();
  _builder.append(" ");
  _builder.append("*/");
  _builder.newLine();
  Task _task = new Task();
  final Procedure1<Task> _function = (Task it) -> {
    it.setTag(DefaultTaskParserTest.createTaskTag("FIXME", Priority.HIGH));
    it.setDescription(" case insensitive match");
    it.setLineNumber(2);
    it.setOffset(6);
  };
  Task _doubleArrow = ObjectExtensions.<Task>operator_doubleArrow(_task, _function);
  this.assertContainsTasks(_builder, 
    Collections.<Task>unmodifiableList(CollectionLiterals.<Task>newArrayList(_doubleArrow)));
}
 
Example #4
Source File: TaskMarkerCreator.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
private int getPriority(Priority priority) {
	switch(priority) {
		case HIGH:
			return IMarker.PRIORITY_HIGH;
		case NORMAL:
			return IMarker.PRIORITY_NORMAL;
		case LOW:
			return IMarker.PRIORITY_LOW;
		default:
			return IMarker.PRIORITY_NORMAL;
	}
}
 
Example #5
Source File: DefaultTaskParserTest.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
@Pure
private static TaskTag createTaskTag(final String tag, final Priority priority) {
  TaskTag _taskTag = new TaskTag();
  final Procedure1<TaskTag> _function = (TaskTag it) -> {
    it.setName(tag);
    it.setPriority(priority);
  };
  return ObjectExtensions.<TaskTag>operator_doubleArrow(_taskTag, _function);
}
 
Example #6
Source File: SarlTaskTagProviderTest.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Test
public void getTaskTags() throws Exception {
	SarlScript script = file(multilineString(
			"/** TODO This is a comment */",
			"agent Foo {",
			"/** FIXME You must fix this!",
			"*/",
			"def foo { // XXX: Inside the code",
			"}",
			"}",
			"//TODO: Complete the code!"),
			true);
	TaskTag tag;
	TaskTags tags = this.provider.getTaskTags(script.eResource());
	assertTrue(tags.isCaseSensitive());
	Iterator<TaskTag> iterator = tags.iterator();

	assertTrue(iterator.hasNext());
	tag = iterator.next();
	assertEquals("TODO", tag.getName());
	assertEquals(Priority.NORMAL, tag.getPriority());

	assertTrue(iterator.hasNext());
	tag = iterator.next();
	assertEquals("FIXME", tag.getName());
	assertEquals(Priority.HIGH, tag.getPriority());

	assertTrue(iterator.hasNext());
	tag = iterator.next();
	assertEquals("XXX", tag.getName());
	assertEquals(Priority.NORMAL, tag.getPriority());

	assertFalse(iterator.hasNext());
}
 
Example #7
Source File: TaskTagInputDialog.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public TaskTagInputDialog(Shell parent, TaskTag task, List<TaskTag> existingEntries,
		String languageName) {
	super(parent);
	this.languageName = languageName;

	existingNames = new ArrayList<String>(existingEntries.size());
	for (int i = 0; i < existingEntries.size(); i++) {
		TaskTag curr = existingEntries.get(i);
		if (!curr.equals(task)) {
			existingNames.add(curr.getName());
		}
	}

	if (task == null) {
		setTitle(PreferencesMessages.TaskTagInputDialog_new_title);
	} else {
		setTitle(PreferencesMessages.TaskTagInputDialog_edit_title);
	}

	TaskTagInputAdapter adapter = new TaskTagInputAdapter();

	nameField = new StringDialogField();
	nameField.setLabelText(PreferencesMessages.TaskTagInputDialog_name_label);
	nameField.setDialogFieldListener(adapter);

	nameField.setText((task != null) ? task.getName() : ""); //$NON-NLS-1$

	String[] items = new String[] { PreferencesMessages.TaskTagInputDialog_priority_high,
			PreferencesMessages.TaskTagInputDialog_priority_normal,
			PreferencesMessages.TaskTagInputDialog_priority_low };

	priorityField = new ComboDialogField(SWT.READ_ONLY);
	priorityField.setLabelText(PreferencesMessages.TaskTagInputDialog_priority_label);
	priorityField.setItems(items);
	if (task != null) {
		if (Priority.HIGH == task.getPriority()) {
			priorityField.selectItem(0);
		} else if (Priority.NORMAL == task.getPriority()) {
			priorityField.selectItem(1);
		} else {
			priorityField.selectItem(2);
		}
	} else {
		priorityField.selectItem(1);
	}
}