Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 235222 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java (-1 / +1 lines)
Lines 28-34 Link Here
28
28
29
	public static final String ATTR_NAME = "name";
29
	public static final String ATTR_NAME = "name";
30
30
31
	public static final String EXTENSION_TASK_EDITOR_EXTENSIONS = "org.eclipse.mylyn.tasks.ui.taskEditorExtensions";
31
	public static final String EXTENSION_TASK_EDITOR_EXTENSIONS = "org.eclipse.mylyn.sandbox.ui.taskEditorExtensions";
32
32
33
	private static final String REPOSITORY_ASSOCIATION = "repositoryAssociation";
33
	private static final String REPOSITORY_ASSOCIATION = "repositoryAssociation";
34
34
(-)plugin.xml (+23 lines)
Lines 357-363 Link Here
357
             state="true">
357
             state="true">
358
       </decorator>
358
       </decorator>
359
    </extension>
359
    </extension>
360
   <extension
361
         point="org.eclipse.mylyn.tasks.ui.editors">
362
      <pageFactory
363
            class="org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaWikiTaskEditorPageFactory"
364
            id="org.eclipse.mylyn.bugzilla.ui.pageFactory">
365
      </pageFactory>     
366
      </extension>
360
   
367
   
368
   <extension
369
         point="org.eclipse.mylyn.sandbox.ui.taskEditorExtensions">
370
      <taskEditorExtension
371
            class="org.eclipse.mylyn.internal.sandbox.ui.editors.DefalutTaskEditorExtension"
372
            id="org.eclipse.mylyn.sandbox.ui.defaultTaskEditorExtension"
373
            name="Textile">
374
      </taskEditorExtension>
375
      <repositoryAssociation
376
            repository="bugzilla"
377
            taskEditorExtension="org.eclipse.mylyn.sandbox.ui.defaultTaskEditorExtension">
378
      </repositoryAssociation>
379
      <repositoryAssociation
380
            repository="local"
381
            taskEditorExtension="org.eclipse.mylyn.sandbox.ui.defaultTaskEditorExtension">
382
      </repositoryAssociation>
383
   </extension>
361
   
384
   
362
   
385
   
363
   <!--
386
   <!--
(-).classpath (-1 / +1 lines)
Lines 1-6 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
2
<classpath>
3
	<classpathentry kind="src" path="src"/>
3
	<classpathentry excluding="org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/TaskEditorWikiNewCommentPart.java|org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/TaskEditorWikiTextPart.java" kind="src" path="src"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
5
		<accessrules>
5
		<accessrules>
6
			<accessrule kind="accessible" pattern="**/internal/**"/>
6
			<accessrule kind="accessible" pattern="**/internal/**"/>
(-)META-INF/MANIFEST.MF (-1 / +3 lines)
Lines 27-33 Link Here
27
 org.eclipse.mylyn.monitor.core;bundle-version="[3.0.0,4.0.0)",
27
 org.eclipse.mylyn.monitor.core;bundle-version="[3.0.0,4.0.0)",
28
 org.eclipse.mylyn.resources.ui;bundle-version="[3.0.0,4.0.0)",
28
 org.eclipse.mylyn.resources.ui;bundle-version="[3.0.0,4.0.0)",
29
 org.eclipse.mylyn.ide.ant;bundle-version="[3.0.0,4.0.0)",
29
 org.eclipse.mylyn.ide.ant;bundle-version="[3.0.0,4.0.0)",
30
 org.eclipse.mylyn.pde.ui;bundle-version="[3.0.0,4.0.0)"
30
 org.eclipse.mylyn.pde.ui;bundle-version="[3.0.0,4.0.0)",
31
 org.eclipse.mylyn.wikitext.ui;bundle-version="1.0.0",
32
 org.eclipse.mylyn.wikitext.textile.core;bundle-version="1.0.0"
31
Bundle-ActivationPolicy: lazy
33
Bundle-ActivationPolicy: lazy
32
Bundle-Vendor: Eclipse.org
34
Bundle-Vendor: Eclipse.org
33
Export-Package: org.eclipse.mylyn.internal.sandbox.bridge.bugs;x-internal:=true,
35
Export-Package: org.eclipse.mylyn.internal.sandbox.bridge.bugs;x-internal:=true,
(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/WikiTextAttributeEditor.java (+143 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla;
10
11
import org.eclipse.jface.text.Document;
12
import org.eclipse.jface.text.ITextListener;
13
import org.eclipse.jface.text.TextEvent;
14
import org.eclipse.jface.text.source.SourceViewer;
15
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes;
16
import org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractTaskEditorExtension;
17
import org.eclipse.mylyn.internal.sandbox.ui.editors.TaskEditorExtensions;
18
import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor;
19
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
20
import org.eclipse.mylyn.tasks.core.TaskRepository;
21
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
22
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
23
import org.eclipse.mylyn.wikitext.ui.viewer.MultiSourceViewer;
24
import org.eclipse.swt.SWT;
25
import org.eclipse.swt.graphics.Font;
26
import org.eclipse.swt.widgets.Composite;
27
import org.eclipse.swt.widgets.Control;
28
import org.eclipse.ui.PlatformUI;
29
import org.eclipse.ui.forms.widgets.FormToolkit;
30
import org.eclipse.ui.themes.IThemeManager;
31
32
/**
33
 * A multitab source viewer that can edit and preview Textile wikitext markup
34
 * 
35
 * FIXME: it will be cool that RichTextAttributeEditor has a protected method to create the SourceViewer
36
 * (RepositoryTextViewer), then subclasses can then create its own SourceViewer without overriding createControl and
37
 * copying the code in it
38
 * 
39
 * @author Jingwen Ou
40
 */
41
public class WikiTextAttributeEditor extends RichTextAttributeEditor {
42
43
	/**
44
	 * left for future extensions
45
	 */
46
//	private boolean enabled = true;
47
//
48
//	public boolean isEnabled() {
49
//		return enabled;
50
//	}
51
//
52
//	public void setEnabled(boolean enabled) {
53
//		this.enabled = enabled;
54
//	}
55
	private final int style;
56
57
	private final TaskRepository taskRepository;
58
59
	private SourceViewer viewer;
60
61
	public WikiTextAttributeEditor(TaskDataModel manager, TaskRepository taskRepository, TaskAttribute taskAttribute,
62
			int style) {
63
		super(manager, taskRepository, taskAttribute, style);
64
		this.style = style;
65
		this.taskRepository = taskRepository;
66
	}
67
68
	public WikiTextAttributeEditor(TaskDataModel manager, TaskRepository taskRepository, TaskAttribute taskAttribute) {
69
		this(manager, taskRepository, taskAttribute, SWT.MULTI);
70
	}
71
72
	@Override
73
	public void createControl(Composite parent, FormToolkit toolkit) {
74
		/**
75
		 * left for future extensions
76
		 */
77
//		if (!isEnabled()) {
78
//			super.createControl(parent, toolkit);
79
//			return;
80
//		}
81
		int style = this.style;
82
		if (!isReadOnly() && (style & TasksUiInternal.SWT_NO_SCROLL) == 0) {
83
			style |= SWT.V_SCROLL;
84
		}
85
86
		AbstractTaskEditorExtension extension = TaskEditorExtensions.getTaskEditorExtension(taskRepository);
87
		if (extension != null) {
88
			if (isReadOnly()) {
89
				viewer = extension.createViewer(taskRepository, parent, style);
90
			} else {
91
				viewer = extension.createEditor(taskRepository, parent, style);
92
			}
93
		}
94
		Document document = new Document(getValue());
95
96
		if (viewer == null) {
97
			super.createControl(parent, toolkit);
98
			return;
99
		}
100
101
		if (isReadOnly()) {
102
			viewer.setEditable(false);
103
			viewer.setDocument(document);
104
		} else {
105
			viewer.setEditable(true);
106
			if (viewer.getDocument() == null) {
107
				viewer.setDocument(document);
108
			}
109
			viewer.addTextListener(new ITextListener() {
110
				public void textChanged(TextEvent event) {
111
					// filter out events caused by text presentation changes, e.g. annotation drawing
112
					String value = viewer.getTextWidget().getText();
113
					if (!getValue().equals(value)) {
114
						setValue(value);
115
					}
116
				}
117
			});
118
119
			viewer.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
120
		}
121
122
		IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
123
		Font font = themeManager.getCurrentTheme().getFontRegistry().get(CommonThemes.FONT_EDITOR_COMMENT);
124
		viewer.getTextWidget().setFont(font);
125
		toolkit.adapt(viewer.getTextWidget(), true, false);
126
127
		setControl(viewer.getTextWidget());
128
	}
129
130
	@Override
131
	public SourceViewer getViewer() {
132
		return viewer;
133
	}
134
135
	@Override
136
	public Control getControl() {
137
		if (viewer instanceof MultiSourceViewer) {
138
			return ((MultiSourceViewer) viewer).getParentControl();
139
		}
140
141
		return super.getControl();
142
	}
143
}
(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/TaskEditorWikiNewCommentPart.java (+27 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla;
10
11
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
12
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
13
import org.eclipse.ui.forms.widgets.ExpandableComposite;
14
15
public class TaskEditorWikiNewCommentPart extends TaskEditorWikiTextPart {
16
	public TaskEditorWikiNewCommentPart() {
17
		setPartName("New Comment");
18
		setSectionStyle(ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED);
19
		setExpandVertically(true);
20
	}
21
22
	@Override
23
	public void initialize(AbstractTaskEditorPage taskEditorPage) {
24
		super.initialize(taskEditorPage);
25
		setAttribute(getModel().getTaskData().getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW));
26
	}
27
}
(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaWikiTaskEditorPageFactory.java (+26 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla;
10
11
import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPageFactory;
12
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
13
import org.eclipse.ui.forms.editor.FormPage;
14
15
/**
16
 * A bugzilla task editor page factory that invokes a task editor page that has wiki facilities
17
 * 
18
 * @author Jingwen Ou
19
 */
20
public class BugzillaWikiTaskEditorPageFactory extends BugzillaTaskEditorPageFactory {
21
22
	@Override
23
	public FormPage createPage(TaskEditor parentEditor) {
24
		return new BugzillaWikiTaskEditorPage(parentEditor);
25
	}
26
}
(-).refactorings/2008/6/23/refactorings.index (+3 lines)
Added Link Here
1
1212827078015	Move compilation unit
2
1212828531765	Move compilation units
3
1212830996265	Extract method 'checkMarkupLanguage'
(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/AbstractMarkupTaskEditorExtension.java (+82 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.sandbox.ui.editors;
10
11
import org.eclipse.jface.text.source.SourceViewer;
12
import org.eclipse.mylyn.tasks.core.TaskRepository;
13
import org.eclipse.mylyn.wikitext.core.parser.markup.MarkupLanguage;
14
import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewer;
15
import org.eclipse.mylyn.wikitext.ui.viewer.MarkupViewerConfiguration;
16
import org.eclipse.mylyn.wikitext.ui.viewer.MultiSourceViewer;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.widgets.Composite;
19
20
/**
21
 * An abstract class that extends AbstractTaskEditorExtension and provides super cool helper methods
22
 * 
23
 * @author Jingwen Ou
24
 */
25
public abstract class AbstractMarkupTaskEditorExtension extends AbstractTaskEditorExtension {
26
27
	private MarkupLanguage markupLanguage;;
28
29
	public AbstractMarkupTaskEditorExtension() {
30
		initializeMarkupLanguage();
31
	}
32
33
	private void checkMarkupLanguageNull() {
34
		if (markupLanguage == null) {
35
			throw new IllegalStateException();
36
		}
37
	}
38
39
	protected SourceViewer createMultiSourceViewer(TaskRepository taskRepository, Composite parent, int style) {
40
		return createMultiSourceViewer(taskRepository, parent, style, true);
41
	}
42
43
	protected SourceViewer createMultiSourceViewer(final TaskRepository taskRepository, Composite parent, int style,
44
			boolean enable) {
45
		checkMarkupLanguageNull();
46
47
		MultiSourceViewer multiSourceViewer = new MultiSourceViewer(parent, null, style | SWT.FLAT | SWT.WRAP) {
48
49
			@Override
50
			protected SourceViewer createPreviewViewer(Composite parent, int style) {
51
				return createReadOnlyViewer(taskRepository, parent, style);
52
			}
53
		};
54
55
		multiSourceViewer.setMarkupLanguage(markupLanguage.clone());
56
		multiSourceViewer.getTextWidget().setEditable(true);
57
58
		return multiSourceViewer;
59
	}
60
61
	protected SourceViewer createReadOnlyViewer(TaskRepository taskRepository, Composite parent, int style) {
62
		checkMarkupLanguageNull();
63
		MarkupViewer markupViewer = new MarkupViewer(parent, null, style | SWT.FLAT | SWT.WRAP);
64
		markupViewer.setMarkupLanguage(markupLanguage.clone());
65
		MarkupViewerConfiguration configuration = new MarkupViewerConfiguration(markupViewer);
66
		markupViewer.configure(configuration);
67
68
		markupViewer.getTextWidget().setEditable(false);
69
70
		return markupViewer;
71
	}
72
73
	public MarkupLanguage getMarkupLanguage() {
74
		return markupLanguage;
75
	}
76
77
	public abstract void initializeMarkupLanguage();
78
79
	public void setMarkupLanguage(MarkupLanguage markupLanguage) {
80
		this.markupLanguage = markupLanguage;
81
	}
82
}
(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/TaskEditorWikiTextPart.java (+131 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla;
10
11
import org.eclipse.jface.layout.GridDataFactory;
12
import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
13
import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor;
14
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRichTextPart;
15
import org.eclipse.mylyn.internal.wikitext.ui.viewer.MultiSourceViewer;
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.graphics.Point;
18
import org.eclipse.swt.layout.GridData;
19
import org.eclipse.swt.layout.GridLayout;
20
import org.eclipse.swt.widgets.Composite;
21
import org.eclipse.swt.widgets.Control;
22
import org.eclipse.ui.forms.widgets.ExpandableComposite;
23
import org.eclipse.ui.forms.widgets.FormToolkit;
24
import org.eclipse.ui.forms.widgets.Section;
25
import org.eclipse.ui.internal.EditorAreaHelper;
26
import org.eclipse.ui.internal.WorkbenchPage;
27
28
public class TaskEditorWikiTextPart extends TaskEditorRichTextPart {
29
30
	private WikiTextAttributeEditor editor;
31
32
	private Composite composite;
33
34
	public TaskEditorWikiTextPart() {
35
		setSectionStyle(ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
36
	}
37
38
	@Override
39
	public void createControl(Composite parent, FormToolkit toolkit) {
40
		if (getAttribute() == null) {
41
			return;
42
		}
43
44
		editor = new WikiTextAttributeEditor(this.getTaskEditorPage().getModel(), this.getTaskEditorPage()
45
				.getTaskRepository(), getAttribute(), SWT.NONE);
46
47
		Section section = createSection(parent, toolkit, getSectionStyle());
48
49
		composite = toolkit.createComposite(section);
50
		GridLayout layout = new GridLayout();
51
		layout.numColumns = 1;
52
		composite.setLayout(layout);
53
54
		editor.createControl(composite, toolkit);
55
		if (editor.isReadOnly()) {
56
			GridDataFactory.fillDefaults().hint(EditorUtil.MAXIMUM_WIDTH, SWT.DEFAULT).applyTo(editor.getControl());
57
		} else {
58
			final GridData gd = new GridData();
59
			// wrap text at this margin, see comment below
60
			int width = getEditorWidth();
61
			// the goal is to make the text viewer as big as the text so it does not require scrolling when first drawn 
62
			// on screen
63
64
			//resizing CTabFolder if enable
65
			Control control = editor.getViewer().getTextWidget();
66
67
			if (editor.getViewer() instanceof MultiSourceViewer) {
68
				control = ((MultiSourceViewer) editor.getViewer()).getParentControl();
69
			}
70
71
			Point size = control.computeSize(width, SWT.DEFAULT, true);
72
			gd.widthHint = EditorUtil.MAXIMUM_WIDTH;
73
			gd.horizontalAlignment = SWT.FILL;
74
			gd.grabExcessHorizontalSpace = true;
75
			// limit height to be avoid dynamic resizing of the text widget: 
76
			// MAXIMUM_HEIGHT < height < MAXIMUM_HEIGHT * 4  
77
			//gd.minimumHeight = AbstractAttributeEditor.MAXIMUM_HEIGHT;
78
			gd.heightHint = Math.min(Math.max(EditorUtil.MAXIMUM_HEIGHT, size.y), EditorUtil.MAXIMUM_HEIGHT * 4);
79
			if (getExpandVertically()) {
80
				gd.verticalAlignment = SWT.FILL;
81
				gd.grabExcessVerticalSpace = true;
82
			}
83
84
			control.setLayoutData(gd);
85
			control.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
86
		}
87
88
		getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
89
90
		toolkit.paintBordersFor(composite);
91
		section.setClient(composite);
92
		setSection(toolkit, section);
93
94
	}
95
96
	@Override
97
	protected Composite getComposite() {
98
		return composite;
99
	}
100
101
	private int getEditorWidth() {
102
		int widthHint = 0;
103
		if (getManagedForm() != null && getManagedForm().getForm() != null) {
104
			widthHint = getManagedForm().getForm().getClientArea().width - 90;
105
		}
106
		if (widthHint <= 0 && getTaskEditorPage().getEditor().getEditorSite() != null
107
				&& getTaskEditorPage().getEditor().getEditorSite().getPage() != null) {
108
			EditorAreaHelper editorManager = ((WorkbenchPage) getTaskEditorPage().getEditor().getEditorSite().getPage()).getEditorPresentation();
109
			if (editorManager != null && editorManager.getLayoutPart() != null) {
110
				widthHint = editorManager.getLayoutPart().getControl().getBounds().width - 90;
111
			}
112
		}
113
		if (widthHint <= 0) {
114
			widthHint = EditorUtil.MAXIMUM_WIDTH;
115
		}
116
		return widthHint;
117
	}
118
119
	@Override
120
	protected RichTextAttributeEditor getEditor() {
121
		return editor;
122
	}
123
124
	@Override
125
	public void setFocus() {
126
		if (editor != null) {
127
			editor.getControl().setFocus();
128
		}
129
	}
130
131
}
(-).refactorings/2008/6/24/refactorings.index (+13 lines)
Added Link Here
1
1213037520062	Extract Class...
2
1213037610406	Move compilation unit
3
1213040114000	Rename type 'MarkupTaskEditorExtension'
4
1213040168578	Rename method 'checkMarkupLanguage'
5
1213045920500	Rename type 'BugzillaTaskEditorPage2'
6
1213047482906	Rename type 'BugzillaTaskEditorPage'
7
1213047834328	Rename type 'BugzillaTaskEditorPageFactory'
8
1213047888812	Delete element
9
1213053930984	Move compilation units
10
1213054335265	Move compilation unit
11
1213054402156	Delete element
12
1213054568421	Move compilation unit
13
1213054607921	Move compilation unit
(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/DefalutTaskEditorExtension.java (+43 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.sandbox.ui.editors;
10
11
import org.eclipse.jface.text.source.SourceViewer;
12
import org.eclipse.mylyn.internal.wikitext.ui.editor.MarkupEditor;
13
import org.eclipse.mylyn.tasks.core.TaskRepository;
14
import org.eclipse.mylyn.wikitext.textile.core.TextileLanguage;
15
import org.eclipse.swt.widgets.Composite;
16
17
/**
18
 * A multitab source viewer that can edit and preview Textile wikitext markup
19
 * 
20
 * @author Jingwen Ou
21
 */
22
public class DefalutTaskEditorExtension extends AbstractMarkupTaskEditorExtension {
23
24
	@Override
25
	public SourceViewer createEditor(TaskRepository taskRepository, Composite parent, int style) {
26
		return createMultiSourceViewer(taskRepository, parent, style);
27
	}
28
29
	@Override
30
	public SourceViewer createViewer(TaskRepository taskRepository, Composite parent, int style) {
31
		return createReadOnlyViewer(taskRepository, parent, style);
32
	}
33
34
	@Override
35
	public String getEditorContextId() {
36
		return MarkupEditor.CONTEXT;
37
	}
38
39
	@Override
40
	public void initializeMarkupLanguage() {
41
		setMarkupLanguage(new TextileLanguage());
42
	}
43
}
(-).refactorings/2008/6/24/refactorings.history (+3 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<session version="1.0">&#x0A;<refactoring className="MultiSourceViewer" comment="Extract class &apos;MultiSourceViewer&apos; from fields in &apos;MultiSourceViewer&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Extracted class name: &apos;MultiSourceViewer&apos;&#x0D;&#x0A;- Package: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors&apos;&#x0D;&#x0A;- Moved fields:&#x0D;&#x0A;     &apos;folder&apos; as &apos;folder&apos;&#x0D;&#x0A;- Field object: &apos;data&apos;" createField0="true" createFieldCount="1" createGetterSetter="false" createTopLevel="true" description="Extract Class..." fieldName="data" flags="6" id="org.eclipse.jdt.ui.extract.class" input="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{MarkupTaskEditorExtension.java[MarkupTaskEditorExtension[MultiSourceViewer" newFieldCount="1" newFieldName0="folder" oldFieldCount="1" oldFieldName0="folder" packageName="org.eclipse.mylyn.internal.sandbox.ui.editors" stamp="1213037520062" version="1.0"/>&#x0A;<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.wikitext.ui/src/org.eclipse.mylyn.internal.wikitext.ui.editor&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.wikitext.ui/src/org.eclipse.mylyn.internal.wikitext.ui.editor&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.MultiSourceViewer.java&apos;&#x0D;&#x0A;- Update references to refactored element" description="Move compilation unit" destination="=org.eclipse.mylyn.wikitext.ui/src&lt;org.eclipse.mylyn.internal.wikitext.ui.editor" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{MultiSourceViewer.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1213037610406" units="1" version="1.0"/>&#x0A;<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.MarkupTaskEditorExtension&apos; to &apos;AbstractMarkupTaskEditorExtension&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.MarkupTaskEditorExtension&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractMarkupTaskEditorExtension&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;MarkupTaskEditorExtension&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{MarkupTaskEditorExtension.java[MarkupTaskEditorExtension" matchStrategy="1" name="AbstractMarkupTaskEditorExtension" qualified="false" references="true" similarDeclarations="false" stamp="1213040114000" textual="false" version="1.0"/>&#x0A;<refactoring comment="Rename method &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractMarkupTaskEditorExtension.checkMarkupLanguage()&apos; to &apos;checkMarkupLanguageNull&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractMarkupTaskEditorExtension.checkMarkupLanguage()&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractMarkupTaskEditorExtension.checkMarkupLanguageNull()&apos;&#x0D;&#x0A;- Update references to refactored element" delegate="false" deprecate="false" description="Rename method &apos;checkMarkupLanguage&apos;" flags="589826" id="org.eclipse.jdt.ui.rename.method" input="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{AbstractMarkupTaskEditorExtension.java[AbstractMarkupTaskEditorExtension~checkMarkupLanguage" name="checkMarkupLanguageNull" references="true" stamp="1213040168578" version="1.0"/>&#x0A;<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPage2&apos; to &apos;BugzillaWikiTaskEditorPage&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPage2&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaWikiTaskEditorPage&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;BugzillaTaskEditorPage2&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla{BugzillaTaskEditorPage2.java[BugzillaTaskEditorPage2" matchStrategy="1" name="BugzillaWikiTaskEditorPage" qualified="false" references="true" similarDeclarations="false" stamp="1213045920500" textual="false" version="1.0"/>&#x0A;<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPage&apos; to &apos;BugzillaTaskEditorPage1&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPage&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPage1&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;BugzillaTaskEditorPage&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla{BugzillaTaskEditorPage.java[BugzillaTaskEditorPage" matchStrategy="1" name="BugzillaTaskEditorPage1" qualified="false" references="true" similarDeclarations="false" stamp="1213047482906" textual="false" version="1.0"/>&#x0A;<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPageFactory&apos; to &apos;BugzillaWikiTaskEditorPageFactory&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPageFactory&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaWikiTaskEditorPageFactory&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;BugzillaTaskEditorPageFactory&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla{BugzillaTaskEditorPageFactory.java[BugzillaTaskEditorPageFactory" matchStrategy="1" name="BugzillaWikiTaskEditorPageFactory" qualified="false" references="true" similarDeclarations="false" stamp="1213047834328" textual="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPage1.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla{BugzillaTaskEditorPage1.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1213047888812" subPackages="false" version="1.0"/>&#x0A;<refactoring comment="Move 2 elements(s) to &apos;org.eclipse.mylyn.wikitext.ui/src/org.eclipse.mylyn.wikitext.ui.viewer&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.wikitext.ui/src/org.eclipse.mylyn.wikitext.ui.viewer&apos;&#x0D;&#x0A;- Original elements:&#x0D;&#x0A;     org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractMarkupTaskEditorExtension.java&#x0D;&#x0A;     org.eclipse.mylyn.internal.sandbox.ui.editors.DefalutTaskEditorExtension.java&#x0D;&#x0A;- Update references to refactored element" description="Move compilation units" destination="=org.eclipse.mylyn.wikitext.ui/src&lt;org.eclipse.mylyn.wikitext.ui.viewer" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{AbstractMarkupTaskEditorExtension.java" element2="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{DefalutTaskEditorExtension.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1213053930984" units="2" version="1.0"/>&#x0A;<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.wikitext.ui/src/org.eclipse.mylyn.wikitext.ui.viewer&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.wikitext.ui/src/org.eclipse.mylyn.wikitext.ui.viewer&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.WikiTextAttributeEditor.java&apos;&#x0D;&#x0A;- Update references to refactored element" description="Move compilation unit" destination="=org.eclipse.mylyn.wikitext.ui/src&lt;org.eclipse.mylyn.wikitext.ui.viewer" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla{WikiTextAttributeEditor.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1213054335265" units="1" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete 1 element(s) from project &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.TaskEditorExtensionHelper.java&apos;" description="Delete element" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{TaskEditorExtensionHelper.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1213054402156" subPackages="false" version="1.0"/>&#x0A;<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.sandbox.ui/src/org.eclipse.mylyn.internal.sandbox.ui.editors&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.sandbox.ui/src/org.eclipse.mylyn.internal.sandbox.ui.editors&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.AbstractMarkupTaskEditorExtension.java&apos;&#x0D;&#x0A;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla{AbstractMarkupTaskEditorExtension.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1213054568421" units="1" version="1.0"/>&#x0A;<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.sandbox.ui/src/org.eclipse.mylyn.internal.sandbox.ui.editors&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.sandbox.ui/src/org.eclipse.mylyn.internal.sandbox.ui.editors&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.DefalutTaskEditorExtension.java&apos;&#x0D;&#x0A;- Update references to refactored element" description="Move compilation unit" destination="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla{DefalutTaskEditorExtension.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1213054607921" units="1" version="1.0"/>
3
</session>
(-)src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaWikiTaskEditorPage.java (+55 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla;
10
11
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
12
import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaCcAttributeEditor;
13
import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaKeywordAttributeEditor;
14
import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPage;
15
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
16
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
17
import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
18
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
19
20
/**
21
 * A bugzilla task editor page that has wiki facilities
22
 * 
23
 * @author Jingwen Ou
24
 */
25
public class BugzillaWikiTaskEditorPage extends BugzillaTaskEditorPage {
26
27
	public BugzillaWikiTaskEditorPage(TaskEditor editor) {
28
		super(editor);
29
	}
30
31
	@Override
32
	protected AttributeEditorFactory createAttributeEditorFactory() {
33
		AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository()) {
34
			@Override
35
			public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute) {
36
				AbstractAttributeEditor editor;
37
				//replace all long rich text, including description part and the comment part, others copied from super class
38
				if (TaskAttribute.TYPE_LONG_RICH_TEXT.equals(type)) {
39
					editor = new WikiTextAttributeEditor(getModel(), getTaskRepository(), taskAttribute);
40
				} else if (IBugzillaConstants.EDITOR_TYPE_KEYWORDS.equals(type)) {
41
					editor = new BugzillaKeywordAttributeEditor(getModel(), taskAttribute);
42
				} else if (IBugzillaConstants.EDITOR_TYPE_REMOVECC.equals(type)) {
43
					editor = new BugzillaCcAttributeEditor(getModel(), taskAttribute);
44
				} else {
45
					editor = super.createEditor(type, taskAttribute);
46
					if (TaskAttribute.TYPE_BOOLEAN.equals(type)) {
47
						editor.setDecorationEnabled(false);
48
					}
49
				}
50
				return editor;
51
			}
52
		};
53
		return factory;
54
	}
55
}
(-).refactorings/2008/6/23/refactorings.history (+3 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
2
<session version="1.0">&#x0A;<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.tasks.ui/src/org.eclipse.mylyn.internal.tasks.ui.editors&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.tasks.ui/src/org.eclipse.mylyn.internal.tasks.ui.editors&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.TaskEditorWikiTextPart.java&apos;&#x0D;&#x0A;- Update references to refactored element" description="Move compilation unit" destination="=org.eclipse.mylyn.tasks.ui/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{TaskEditorWikiTextPart.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1212827078015" units="1" version="1.0"/>&#x0A;&#x0A;<refactoring comment="Move 3 elements(s) to &apos;org.eclipse.mylyn.sandbox.ui/src/org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.sandbox.ui/src/org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla&apos;&#x0D;&#x0A;- Original elements:&#x0D;&#x0A;     org.eclipse.mylyn.internal.sandbox.ui.editors.WikiTextAttributeEditor.java&#x0D;&#x0A;     org.eclipse.mylyn.internal.sandbox.ui.editors.BugzillaTaskEditorPage.java&#x0D;&#x0A;     org.eclipse.mylyn.internal.sandbox.ui.editors.TaskEditorWikiTextPart.java&#x0D;&#x0A;- Update references to refactored element" description="Move compilation units" destination="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla" element1="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{WikiTextAttributeEditor.java" element2="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{BugzillaTaskEditorPage.java" element3="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{TaskEditorWikiTextPart.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*" policy="org.eclipse.jdt.ui.moveResources" qualified="false" references="true" stamp="1212828531765" units="3" version="1.0"/>&#x0A;<refactoring comment="Extract method &apos;private void checkMarkupLanguage()&apos; from &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.MarkupTaskEditorExtension.createReadOnlyViewer()&apos; to &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.MarkupTaskEditorExtension&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.sandbox.ui&apos;&#x0D;&#x0A;- Method name: &apos;checkMarkupLanguage&apos;&#x0D;&#x0A;- Destination type: &apos;org.eclipse.mylyn.internal.sandbox.ui.editors.MarkupTaskEditorExtension&apos;&#x0D;&#x0A;- Declared visibility: &apos;private&apos;&#x0D;&#x0A;- Replace occurrences of statements with method" comments="false" description="Extract method &apos;checkMarkupLanguage&apos;" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src&lt;org.eclipse.mylyn.internal.sandbox.ui.editors{MarkupTaskEditorExtension.java" name="checkMarkupLanguage" replace="true" selection="3921 73" stamp="1212830996265" version="1.0" visibility="2"/>
3
</session>

Return to bug 235222