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 104592 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]
patch that solves the 'jumping around editor' issue
mylyn.sandbox.patch2.txt (text/plain), 7.42 KB, created by
David Green
on 2008-06-11 20:27:10 EDT
(
hide
)
Description:
patch that solves the 'jumping around editor' issue
Filename:
MIME Type:
Creator:
David Green
Created:
2008-06-11 20:27:10 EDT
Size:
7.42 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.sandbox.ui >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,196 @@ >+/******************************************************************************* >+ * 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.layout.GridDataFactory; >+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.layout.GridLayout; >+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); >+ folder.setLayout(new GridLayout()); >+ >+ /** 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); >+ source.getTextWidget().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); >+ >+ 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; >+// }
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