<commit_before>/*******************************************************************************
 * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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
 *
 * Contributors:
 *     Mylar project committers - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.internal.jira.ui;

import java.text.DateFormat;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.mylar.internal.jira.JiraServerFacade;
import org.eclipse.mylar.internal.jira.JiraTask;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
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.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.internal.forms.widgets.*;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.tigris.jira.core.model.Comment;
import org.tigris.jira.core.model.Issue;
import org.tigris.jira.core.service.JiraServer;

/**
 * @author <NAME>
 * @author <NAME> (minor fixes)
 */
public class JiraTaskEditor extends EditorPart {

	private static final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);

	private JiraIssueEditorInput input;

	private Text comment;

	private boolean isDirty = false;

	private Map<Comment, ExpandableComposite> commentToControlMap = new HashMap<Comment, ExpandableComposite>();

	private JiraServer server;

	private Issue issue;

	private ScrolledComposite sc;

	private Section commentsSection;

	public JiraTaskEditor() {
		// commentImage =
		// MylarJiraPlugin.getImageDescriptor("icons/ctool16/comment.gif").createImage();
		// commentFont =
		// JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
	}

	public void doSave(IProgressMonitor monitor) {
		server.addCommentToIssue(issue, comment.getText());
		comment.setText("");
		isDirty = false;
	}

	public boolean isSaveAsAllowed() {
		return false;
	}
	
	public void doSaveAs() {
	}
<commit_msg>Completed: 133764: Form based editor for Jira tasks https://bugs.eclipse.org/bugs/show_bug.cgi?id=133764<commit_after>/*******************************************************************************
 * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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
 *
 * Contributors:
 *     Mylar project committers - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.internal.jira.ui;

import java.text.DateFormat;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.mylar.internal.jira.JiraServerFacade;
import org.eclipse.mylar.internal.jira.JiraTask;
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.provisional.tasklist.TaskRepository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
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.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.forms.events.ExpansionAdapter;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.internal.forms.widgets.*;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
import org.tigris.jira.core.model.Comment;
import org.tigris.jira.core.model.Issue;
import org.tigris.jira.core.service.JiraServer;

/**
 * @author <NAME>
 * @author <NAME> (minor fixes)
 */
public class JiraTaskEditor extends EditorPart {

	private static final DateFormat DATE_FORMAT = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);

	private JiraIssueEditorInput input;

	private Text comment;

	private boolean isDirty = false;

	private Map<Comment, ExpandableComposite> commentToControlMap = new HashMap<Comment, ExpandableComposite>();

	private JiraServer server;

	private Issue issue;

	private ScrolledComposite sc;

	private Section commentsSection;

	public JiraTaskEditor() {
		// commentImage =
		// MylarJiraPlugin.getImageDescriptor("icons/ctool16/comment.gif").createImage();
		// commentFont =
		// JFaceResources.getFontRegistry().getBold(JFaceResources.DEFAULT_FONT);
	}

	public void doSave(IProgressMonitor monitor) {
		server.addCommentToIssue(issue, comment.getText());
		comment.setText("");
		isDirty = false;
//		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
//
//			public void run() {
//				JiraTaskEditor.this.getSite().getPage().closeEditor(JiraTaskEditor.this, false);
//			} });
	}

	public boolean isSaveAsAllowed() {
		return false;
	}
	
	public void doSaveAs() {
	}

{'fraction_non_alphanumeric': 0.14972738711030337, 'fraction_numerical': 0.005592059275828324, 'mean_word_length': 5.599630996309963, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3754981', 'n_tokens_mistral': 2273, 'n_tokens_neox': 2149, 'n_words': 415}