org.eclipse.xtext.tasks.TaskTag Java Examples

The following examples show how to use org.eclipse.xtext.tasks.TaskTag. 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: XtendTaskTagProvider.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public TaskTags getTaskTags(final Resource resource) {
  TaskTags _xblockexpression = null;
  {
    final IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource);
    PreferenceKey _preferenceKey = new PreferenceKey(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX");
    final String namePref = prefs.getPreference(_preferenceKey);
    PreferenceKey _preferenceKey_1 = new PreferenceKey(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL");
    final String prioritiesPref = prefs.getPreference(_preferenceKey_1);
    PreferenceKey _preferenceKey_2 = new PreferenceKey(JavaCore.COMPILER_TASK_CASE_SENSITIVE, JavaCore.ENABLED);
    final String caseSensitivePref = prefs.getPreference(_preferenceKey_2);
    final List<TaskTag> tags = PreferenceTaskTagProvider.parseTags(namePref, prioritiesPref);
    TaskTags _taskTags = new TaskTags();
    final Procedure1<TaskTags> _function = (TaskTags it) -> {
      List<TaskTag> _taskTags_1 = it.getTaskTags();
      Iterables.<TaskTag>addAll(_taskTags_1, tags);
      it.setCaseSensitive(caseSensitivePref.equals(JavaCore.ENABLED));
    };
    _xblockexpression = ObjectExtensions.<TaskTags>operator_doubleArrow(_taskTags, _function);
  }
  return _xblockexpression;
}
 
Example #4
Source File: SarlTaskTagProvider.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public TaskTags getTaskTags(Resource resource) {
	final IPreferenceValues prefs = this.preferenceValuesProvider.getPreferenceValues(resource);
	final String namePref = prefs.getPreference(new PreferenceKey(
			JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX")); //$NON-NLS-1$
	final String prioritiesPref = prefs.getPreference(new PreferenceKey(
			JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,NORMAL")); //$NON-NLS-1$
	final String caseSensitivePref = prefs.getPreference(new PreferenceKey(
			JavaCore.COMPILER_TASK_CASE_SENSITIVE, JavaCore.ENABLED));
	final List<TaskTag> tags = PreferenceTaskTagProvider.parseTags(namePref, prioritiesPref);

	final TaskTags taskTags = new TaskTags();
	taskTags.setCaseSensitive(caseSensitivePref.equals(JavaCore.ENABLED));
	taskTags.getTaskTags().addAll(tags);
	return taskTags;
}
 
Example #5
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void doubleClicked(ListDialogField field) {
	@SuppressWarnings("unchecked")
	List<TaskTag> selectedElements = field.getSelectedElements();
	if (canEdit(selectedElements)) {
		taskTagButtonPressed(IDX_EDIT);
	}
}
 
Example #6
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected final void updateModel(DialogField field) {
	if (field == taskTags) {
		@SuppressWarnings("unchecked")
		List<TaskTag> list = taskTags.getElements();
		setValue(getTaskTagsKey(), serializeTags(list));
		setValue(getTaskPrioritiesKey(), serializePriorities(list));
	} else if (field == caseSensitiveCheckBox) {
		String state = caseSensitiveCheckBox.isSelected() ? ENABLED : DISABLED;
		setValue(getTasksCaseSensitiveKey(), state);
	}
}
 
Example #7
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 #8
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 #9
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
	return getComparator().compare(((TaskTag) e1).getName(), ((TaskTag) e2).getName());
}
 
Example #10
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
private boolean canEdit(List<TaskTag> selectedElements) {
	return selectedElements.size() == 1;
}
 
Example #11
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void selectionChanged(ListDialogField field) {
	@SuppressWarnings("unchecked")
	List<TaskTag> selectedElements = field.getSelectedElements();
	field.enableButton(IDX_EDIT, canEdit(selectedElements));
}
 
Example #12
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);
	}
}
 
Example #13
Source File: XtendTaskFinderTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public static void assertExactMatch(final TaskTag expected, final TaskTag actual) {
  Assert.assertEquals(expected.getName(), actual.getName());
  Assert.assertEquals(expected.getPriority(), actual.getPriority());
}
 
Example #14
Source File: SCTTask.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public TaskTag getTag() {
	return delgate.getTag();
}
 
Example #15
Source File: SCTTask.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public void setTag(TaskTag tag) {
	delgate.setTag(tag);
}