Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others. 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 /
  
  package org.eclipse.xtext.ui.tasks.preferences;
  
 import static org.eclipse.xtext.tasks.PreferenceTaskTagProvider.*;
 import static org.eclipse.xtext.ui.tasks.preferences.TaskTagInputDialog.*;
 
 import java.util.List;
 
 import  org.eclipse.core.resources.IProject;
 import  org.eclipse.core.resources.ResourcesPlugin;
 import  org.eclipse.core.runtime.jobs.Job;
 import  org.eclipse.jface.layout.PixelConverter;
 import  org.eclipse.jface.preference.IPreferenceStore;
 import  org.eclipse.jface.viewers.IFontProvider;
 import  org.eclipse.jface.viewers.ITableLabelProvider;
 import  org.eclipse.jface.viewers.LabelProvider;
 import  org.eclipse.jface.viewers.Viewer;
 import  org.eclipse.jface.viewers.ViewerComparator;
 import  org.eclipse.jface.window.Window;
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.graphics.Font;
 import  org.eclipse.swt.graphics.Image;
 import  org.eclipse.swt.layout.GridData;
 import  org.eclipse.swt.layout.GridLayout;
 import  org.eclipse.swt.widgets.Composite;
 import  org.eclipse.swt.widgets.Control;
 import  org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;

Author(s):
Stefan Oehme - Initial contribution and API
 
 	public static final String SETTINGS_SECTION_NAME = "TaskTagConfigurationBlock"//$NON-NLS-1$
 
 	private static final int IDX_ADD = 0;
 	private static final int IDX_EDIT = 1;
 	private static final int IDX_REMOVE = 2;
 
 	private static final String PROPERTY_PREFIX = "TaskTagConfiguration";
 
 	private String languageName;
 
 	public TaskTagConfigurationBlock(IProject project, IPreferenceStore preferenceStore,
 			IWorkbenchPreferenceContainer containerString languageName) {
 		super(projectpreferenceStorecontainer);
 		this. = languageName;
 		 = new ListDialogField(adapterbuttonsnew TaskTagLabelProvider());
 
 		String[] columnsHeaders = new String[] {
 
 
 
 		if (.getSize() > 0) {
 		} else {
 		}
 	}
 
 	protected Control doCreateContents(Composite parent) {
 		GridLayout layout = new GridLayout();
 		layout.marginHeight = 0;
 		layout.marginWidth = 0;
 		layout.numColumns = 2;
 
 		PixelConverter conv = new PixelConverter(parent);
		Composite markersComposite = new Composite(parent, SWT.NULL);
		markersComposite.setLayout(layout);
		markersComposite.setFont(parent.getFont());
		GridData data = new GridData(GridData.FILL_BOTH);
		data.widthHint = conv.convertWidthInCharsToPixels(50);
		Control listControl = .getListControl(markersComposite);
		listControl.setLayoutData(data);
		Control buttonsControl = .getButtonBox(markersComposite);
		buttonsControl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));
		return markersComposite;
	}
	private class TaskTagLabelProvider extends LabelProvider implements ITableLabelProvider, IFontProvider {
		public Image getImage(Object element) {
			return null;
		}
		public String getText(Object element) {
			return getColumnText(element, 0);
		}
		public Image getColumnImage(Object elementint columnIndex) {
			return null;
		}
		public String getColumnText(Object elementint columnIndex) {
			TaskTag task = (TaskTagelement;
			if (columnIndex == 0) {
				return task.getName();
else {
				if (. == task.getPriority()) {
else if (. == task.getPriority()) {
else if (. == task.getPriority()) {
				}
				return "";
			}
		}
		public Font getFont(Object element) {
			return null;
		}
	}
	private static class TaskTagSorter extends ViewerComparator {
		@SuppressWarnings("unchecked")
		public int compare(Viewer viewerObject e1Object e2) {
			return getComparator().compare(((TaskTage1).getName(), ((TaskTage2).getName());
		}
	}
	private class TaskTagListAdapter implements IListAdapterIDialogFieldListener {
		private boolean canEdit(List<TaskTagselectedElements) {
			return selectedElements.size() == 1;
		}
		public void customButtonPressed(ListDialogField fieldint index) {
		}
		public void selectionChanged(ListDialogField field) {
			@SuppressWarnings("unchecked")
			List<TaskTagselectedElements = field.getSelectedElements();
			field.enableButton(canEdit(selectedElements));
		}
		public void doubleClicked(ListDialogField field) {
			@SuppressWarnings("unchecked")
			List<TaskTagselectedElements = field.getSelectedElements();
			if (canEdit(selectedElements)) {
			}
		}
		public void dialogFieldChanged(DialogField field) {
		}
	}
	public void setEnabled(boolean isEnabled) {
		.setEnabled(isEnabled);
	}
	protected final void updateModel(DialogField field) {
		if (field == ) {
			@SuppressWarnings("unchecked")
else if (field == ) {
		}
	}
	}
	}
	private String getTaskTagsKey() {
		return .getId();
	}
	protected void updateControls() {
	}
	private void unpackTaskTags() {
		.setElements(parseTags(rawTagsrawPrios));
		boolean isCaseSensitive = .equals(getValue(getTasksCaseSensitiveKey()));
	}
	private void taskTagButtonPressed(int index) {
		TaskTag edited = null;
		if (index != ) {
		}
		if (index ==  || index == ) {
			@SuppressWarnings("unchecked")
			if (dialog.open() == Window.OK) {
				if (edited != null) {
					.replaceElement(editeddialog.getResult());
else {
				}
			}
		}
	}
	protected void validateSettings(String changedKeyString oldValueString newValue) {
	}
	protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
		String message;
		if (getProject() == null) {
else {
		}
		return new String[] { titlemessage };
	}
	protected Job getBuildJob(IProject project) {
		Job buildJob = new OptionsConfigurationBlock.BuildJob("Rebuild"project);
		buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
		buildJob.setUser(true);
		return buildJob;
	}
	}
New to GrepCode? Check out our FAQ X