Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 104576 Details for
Bug 235222
[wikitext] integrates Texile-J with bugzilla task editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
wiki integration step 3
clipboard.txt (text/plain), 16.40 KB, created by
Jingwen 'Owen' Ou
on 2008-06-11 19:05:13 EDT
(
hide
)
Description:
wiki integration step 3
Filename:
MIME Type:
Creator:
Jingwen 'Owen' Ou
Created:
2008-06-11 19:05:13 EDT
Size:
16.40 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.sandbox.ui >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java,v >retrieving revision 1.1 >diff -u -r1.1 TaskEditorExtensions.java >--- src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java 6 Jun 2008 22:55:54 -0000 1.1 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensions.java 11 Jun 2008 22:50:27 -0000 >@@ -34,6 +34,7 @@ > private static boolean initialized; > > public static SortedSet<RegisteredTaskEditorExtension> getTaskEditorExtensions() { >+ init(); > return new TreeSet<RegisteredTaskEditorExtension>(extensionsById.values()); > } > >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java,v >retrieving revision 1.1 >diff -u -r1.1 TaskEditorExtensionReader.java >--- src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java 6 Jun 2008 22:55:54 -0000 1.1 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/TaskEditorExtensionReader.java 11 Jun 2008 22:50:27 -0000 >@@ -28,7 +28,7 @@ > > public static final String ATTR_NAME = "name"; > >- public static final String EXTENSION_TASK_EDITOR_EXTENSIONS = "org.eclipse.mylyn.tasks.ui.taskEditorExtensions"; >+ public static final String EXTENSION_TASK_EDITOR_EXTENSIONS = "org.eclipse.mylyn.sandbox.ui.taskEditorExtensions"; > > private static final String REPOSITORY_ASSOCIATION = "repositoryAssociation"; > >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/plugin.xml,v >retrieving revision 1.82 >diff -u -r1.82 plugin.xml >--- plugin.xml 6 Jun 2008 22:55:55 -0000 1.82 >+++ plugin.xml 11 Jun 2008 22:50:27 -0000 >@@ -357,6 +357,13 @@ > state="true"> > </decorator> > </extension> >+ <extension >+ point="org.eclipse.mylyn.tasks.ui.editors"> >+ <pageFactory >+ class="org.eclipse.mylyn.internal.sandbox.ui.editors.bugzilla.BugzillaTaskEditorPageFactory2" >+ id="org.eclipse.mylyn.bugzilla.ui.pageFactory"> >+ </pageFactory> >+ </extension> > > > >@@ -389,6 +396,7 @@ > contentProvider="org.eclipse.mylyn.internal.sandbox.ui.GroupedTaskListContentProvider:Sheduled"/> > </extension> > --> >+ > > </plugin> > >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPageFactory2.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPageFactory2.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPageFactory2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPageFactory2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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.mylyn.internal.sandbox.ui.editors.bugzilla; >+ >+import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPageFactory; >+import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; >+import org.eclipse.ui.forms.editor.FormPage; >+ >+/** >+ * A bugzilla task editor page factory that invokes a task editor page that has wiki facilities >+ * >+ * @author Jingwen Ou >+ */ >+public class BugzillaTaskEditorPageFactory2 extends BugzillaTaskEditorPageFactory { >+ >+ @Override >+ public FormPage createPage(TaskEditor parentEditor) { >+ return new BugzillaTaskEditorPage2(parentEditor); >+ } >+} >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/RichTextAttributeEditor2.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/RichTextAttributeEditor2.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/RichTextAttributeEditor2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/RichTextAttributeEditor2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,191 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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.mylyn.internal.sandbox.ui.editors.bugzilla; >+ >+import org.eclipse.jface.text.Document; >+import org.eclipse.jface.text.ITextListener; >+import org.eclipse.jface.text.TextEvent; >+import org.eclipse.jface.text.source.SourceViewer; >+import org.eclipse.jface.viewers.Viewer; >+import org.eclipse.mylyn.internal.provisional.commons.ui.CommonThemes; >+import org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractTaskEditorExtension; >+import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >+import org.eclipse.mylyn.tasks.core.data.TaskDataModel; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.CTabFolder; >+import org.eclipse.swt.custom.CTabItem; >+import org.eclipse.swt.events.DisposeEvent; >+import org.eclipse.swt.events.DisposeListener; >+import org.eclipse.swt.events.FocusEvent; >+import org.eclipse.swt.events.FocusListener; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.graphics.Font; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.contexts.IContextActivation; >+import org.eclipse.ui.contexts.IContextService; >+import org.eclipse.ui.forms.widgets.FormToolkit; >+import org.eclipse.ui.themes.IThemeManager; >+ >+/** >+ * A multitab source viewer that can edit and preview Textile wikitext markup >+ * >+ * FIXME: it will be cool that RichTextAttributeEditor has a protected method to create the SourceViewer >+ * (RepositoryTextViewer), then subclasses can then create its own SourceViewer without overriding createControl and >+ * copying the code in it >+ * >+ * @author Jingwen Ou >+ */ >+public class RichTextAttributeEditor2 extends RichTextAttributeEditor { >+ >+ private SourceViewer source; >+ >+ private final TaskRepository taskRepository; >+ >+ private final int styles; >+ >+ private final IContextService contextService; >+ >+ private IContextActivation contextActivation; >+ >+ private final AbstractTaskEditorExtension extension; >+ >+ public RichTextAttributeEditor2(IContextService contextService, TaskDataModel manager, >+ TaskRepository taskRepository, AbstractTaskEditorExtension extension, TaskAttribute taskAttribute, >+ int styles) { >+ super(manager, taskRepository, taskAttribute, styles); >+ this.contextService = contextService; >+ this.taskRepository = taskRepository; >+ this.extension = extension; >+ this.styles = styles; >+ } >+ >+ @Override >+ public SourceViewer getViewer() { >+ return source; >+ } >+ >+ @Override >+ public void createControl(Composite parent, FormToolkit toolkit) { >+ if (isReadOnly()) { >+ source = extension.createViewer(taskRepository, parent, styles); >+ source.setDocument(new Document(getValue())); >+ >+ setControl(source instanceof Viewer ? ((Viewer) source).getControl() : source.getTextWidget()); >+ } else { >+ CTabFolder folder = new CTabFolder(parent, SWT.FLAT | SWT.BOTTOM); >+ >+ /** wikitext markup editor **/ >+ >+ CTabItem viewerItem = new CTabItem(folder, SWT.NONE); >+ viewerItem.setText("Source"); >+ viewerItem.setToolTipText("Edit Source"); >+ >+ source = extension.createEditor(taskRepository, folder, styles | SWT.V_SCROLL); >+ if (source.getDocument() == null) { >+ source.setDocument(new Document(getValue())); >+ } >+ source.addTextListener(new ITextListener() { >+ public void textChanged(TextEvent event) { >+ // filter out events caused by text presentation changes, e.g. annotation drawing >+ String value = source.getTextWidget().getText(); >+ if (!getValue().equals(value)) { >+ setValue(value); >+ } >+ } >+ }); >+ source.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); >+ >+ //setting up focus stuff, copied from Daivd's solution >+ FocusListener focusListener = new FocusListener() { >+ >+ public void focusGained(FocusEvent e) { >+ setContext(); >+ } >+ >+ public void focusLost(FocusEvent e) { >+ unsetContext(); >+ } >+ }; >+ source.getTextWidget().addFocusListener(focusListener); >+ DisposeListener disposeListener = new DisposeListener() { >+ public void widgetDisposed(DisposeEvent e) { >+ unsetContext(); >+ } >+ }; >+ source.getTextWidget().addDisposeListener(disposeListener); >+ >+ viewerItem.setControl(source instanceof Viewer ? ((Viewer) source).getControl() : source.getTextWidget()); >+ folder.setSelection(viewerItem); >+ >+ /** wikitext markup viewer **/ >+ >+ CTabItem previewItem = new CTabItem(folder, SWT.NONE); >+ previewItem.setText("Preview"); >+ previewItem.setToolTipText("Preview Source"); >+ >+ final SourceViewer preview = extension.createViewer(taskRepository, folder, styles); >+ >+ previewItem.setControl(preview instanceof Viewer ? ((Viewer) preview).getControl() >+ : preview.getTextWidget()); >+ >+ folder.addSelectionListener(new SelectionListener() { >+ public void widgetDefaultSelected(SelectionEvent selectionevent) { >+ widgetSelected(selectionevent); >+ } >+ >+ public void widgetSelected(SelectionEvent selectionevent) { >+ Document document = new Document(source.getDocument().get()); >+ preview.setDocument(document); >+ } >+ }); >+ >+ setControl(folder); >+ } >+ >+ IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager(); >+ Font font = themeManager.getCurrentTheme().getFontRegistry().get(CommonThemes.FONT_EDITOR_COMMENT); >+ source.getTextWidget().setFont(font); >+ toolkit.adapt(source.getControl(), true, false); >+ >+ } >+ >+ protected void unsetContext() { >+ if (contextActivation != null) { >+ contextService.deactivateContext(contextActivation); >+ contextActivation = null; >+ } >+ } >+ >+ protected void setContext() { >+ if (contextActivation != null) { >+ contextService.deactivateContext(contextActivation); >+ contextActivation = null; >+ } >+ if (contextService != null && extension.getEditorContextId() != null) { >+ contextActivation = contextService.activateContext(extension.getEditorContextId()); >+ } >+ } >+} >+ >+/** >+ * left for future extensions >+ */ >+// private boolean enabled = true; >+// >+// public boolean isEnabled() { >+// return enabled; >+// } >+// >+// public void setEnabled(boolean enabled) { >+// this.enabled = enabled; >+// } >Index: src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPage2.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPage2.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPage2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/editors/bugzilla/BugzillaTaskEditorPage2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,72 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2007 Mylyn project committers 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.mylyn.internal.sandbox.ui.editors.bugzilla; >+ >+import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; >+import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaCcAttributeEditor; >+import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaKeywordAttributeEditor; >+import org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPage; >+import org.eclipse.mylyn.internal.sandbox.ui.editors.AbstractTaskEditorExtension; >+import org.eclipse.mylyn.internal.sandbox.ui.editors.TaskEditorExtensions; >+import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >+import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor; >+import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory; >+import org.eclipse.mylyn.tasks.ui.editors.TaskEditor; >+import org.eclipse.swt.SWT; >+import org.eclipse.ui.contexts.IContextService; >+ >+/** >+ * A bugzilla task editor page that has wiki facilities >+ * >+ * @author Jingwen Ou >+ */ >+public class BugzillaTaskEditorPage2 extends BugzillaTaskEditorPage { >+ >+ public BugzillaTaskEditorPage2(TaskEditor editor) { >+ super(editor); >+ } >+ >+ @Override >+ protected AttributeEditorFactory createAttributeEditorFactory() { >+ AttributeEditorFactory factory = new AttributeEditorFactory(getModel(), getTaskRepository()) { >+ @Override >+ public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute) { >+ >+ //replace all long rich text & short rich text, including description part and the comment part, others copied from super class >+ AbstractTaskEditorExtension extension = TaskEditorExtensions.getTaskEditorExtension(getTaskRepository()); >+ if (extension != null) { >+ if (TaskAttribute.TYPE_LONG_RICH_TEXT.equals(type)) { >+ return new RichTextAttributeEditor2((IContextService) getEditor().getEditorSite().getService( >+ IContextService.class), getModel(), getTaskRepository(), extension, taskAttribute, >+ SWT.MULTI); >+ } else if (TaskAttribute.TYPE_SHORT_RICH_TEXT.equals(type)) { >+ return new RichTextAttributeEditor2((IContextService) getEditor().getEditorSite().getService( >+ IContextService.class), getModel(), getTaskRepository(), extension, taskAttribute, >+ SWT.SINGLE); >+ } >+ } >+ >+ // copied from BugzillaTaskEditorPage#createAttributeEditorFactory(), create other editors >+ AbstractAttributeEditor editor; >+ if (IBugzillaConstants.EDITOR_TYPE_KEYWORDS.equals(type)) { >+ editor = new BugzillaKeywordAttributeEditor(getModel(), taskAttribute); >+ } else if (IBugzillaConstants.EDITOR_TYPE_REMOVECC.equals(type)) { >+ editor = new BugzillaCcAttributeEditor(getModel(), taskAttribute); >+ } else { >+ editor = super.createEditor(type, taskAttribute); >+ if (TaskAttribute.TYPE_BOOLEAN.equals(type)) { >+ editor.setDecorationEnabled(false); >+ } >+ } >+ return editor; >+ } >+ }; >+ return factory; >+ } >+} >#P org.eclipse.mylyn.bugzilla.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.ui/plugin.xml,v >retrieving revision 1.100 >diff -u -r1.100 plugin.xml >--- plugin.xml 30 May 2008 01:40:23 -0000 1.100 >+++ plugin.xml 11 Jun 2008 22:50:27 -0000 >@@ -58,12 +58,6 @@ > </language> > </extension> > >- <extension >- point="org.eclipse.mylyn.tasks.ui.editors"> >- <pageFactory >- class="org.eclipse.mylyn.internal.bugzilla.ui.editor.BugzillaTaskEditorPageFactory" >- id="org.eclipse.mylyn.bugzilla.ui.pageFactory"> >- </pageFactory> >- </extension> >+ > > </plugin>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 235222
:
103264
|
103615
|
104084
|
104233
|
104234
|
104240
| 104576 |
104592
|
104650
|
104651
|
104678
|
104721