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 132602 Details for
Bug 271787
[compare] CompilationUnitEditorAdapter creation flow should be more like a flow of a standalone editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Embedding Java Editor
clipboard.txt (text/plain), 5.36 KB, created by
Tomasz Zarna
on 2009-04-21 09:07:20 EDT
(
hide
)
Description:
Embedding Java Editor
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2009-04-21 09:07:20 EDT
Size:
5.36 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/plugin.xml,v >retrieving revision 1.827 >diff -u -r1.827 plugin.xml >--- plugin.xml 25 Mar 2009 17:54:58 -0000 1.827 >+++ plugin.xml 21 Apr 2009 13:05:15 -0000 >@@ -990,6 +990,13 @@ > launcher="org.eclipse.jdt.internal.ui.jarpackager.OpenJarExportWizardEditorLauncher" > name="%jarDescEditorName"> > </editor> >+ <editor >+ class="org.eclipse.jdt.internal.ui.javaeditor.EmbeddingJavaEditor" >+ default="false" >+ extensions="cjava" >+ id="org.eclipse.jdt.ui.embeddingJaveEditor" >+ name="Embedding Java Editor"> >+ </editor> > </extension> > > <extension >Index: ui/org/eclipse/jdt/internal/ui/javaeditor/EmbeddingJavaEditor.java >=================================================================== >RCS file: ui/org/eclipse/jdt/internal/ui/javaeditor/EmbeddingJavaEditor.java >diff -N ui/org/eclipse/jdt/internal/ui/javaeditor/EmbeddingJavaEditor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ ui/org/eclipse/jdt/internal/ui/javaeditor/EmbeddingJavaEditor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,133 @@ >+package org.eclipse.jdt.internal.ui.javaeditor; >+ >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.layout.FillLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Sash; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+ >+import org.eclipse.jface.preference.IPreferenceStore; >+ >+import org.eclipse.jface.text.Document; >+import org.eclipse.jface.text.source.IOverviewRuler; >+import org.eclipse.jface.text.source.IVerticalRuler; >+import org.eclipse.jface.text.source.SourceViewerConfiguration; >+ >+import org.eclipse.ui.IEditorInput; >+import org.eclipse.ui.IEditorSite; >+import org.eclipse.ui.PartInitException; >+import org.eclipse.ui.part.EditorPart; >+ >+public class EmbeddingJavaEditor extends EditorPart { >+ >+ CompilationUnitEditor embeddedEditor; >+ CompilationUnitEditor embeddedEditor2; >+ >+ public EmbeddingJavaEditor() { >+ embeddedEditor = new CompilationUnitEditorAdapter(SWT.LEFT_TO_RIGHT); >+ embeddedEditor2 = new CompilationUnitEditorAdapter(SWT.LEFT_TO_RIGHT); >+ } >+ >+ public void doSave(IProgressMonitor monitor) { >+ } >+ >+ public void doSaveAs() { >+ } >+ >+ public void init(IEditorSite site, IEditorInput input) throws PartInitException { >+ setSite(site); >+ setInput(input); >+ >+ } >+ >+ public boolean isDirty() { >+ return false; >+ } >+ >+ public boolean isSaveAsAllowed() { >+ return false; >+ } >+ >+ public void createPartControl(Composite parent) { >+ Composite c = new Composite(parent, SWT.NONE); >+ c.setLayout(new FillLayout()); >+ >+ try { >+ embeddedEditor.init(getEditorSite(), getEditorInput()); >+ embeddedEditor.createPartControl(c); >+ embeddedEditor.getViewer().setDocument(new Document("public class A {\n}")); >+ >+ Sash s = new Sash(c, SWT.VERTICAL); >+ >+ embeddedEditor2.init(getEditorSite(), getEditorInput()); >+ embeddedEditor2.createPartControl(c); >+ embeddedEditor2.getViewer().setDocument(new Document("public class B {\n}")); >+ >+ } catch (PartInitException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ >+ } >+ >+ public void setFocus() { >+ } >+ >+ private class CompilationUnitEditorAdapter extends CompilationUnitEditor { >+ private boolean fInputSet = false; >+ private int fTextOrientation; >+ private boolean fEditable; >+ >+ CompilationUnitEditorAdapter(int textOrientation) { >+ super(); >+ fTextOrientation = textOrientation; >+ // TODO: has to be set here >+// setPreferenceStore(createChainedPreferenceStore(null)); >+ } >+ public void createActions() { >+ if (fInputSet) { >+ super.createActions(); >+ // to avoid handler conflicts disable extra actions >+ // we're not handling by CompareHandlerService >+ getCorrectionCommands().deregisterCommands(); >+ getRefactorActionGroup().dispose(); >+ getGenerateActionGroup().dispose(); >+ } >+ // else do nothing, we will create actions later, when input is available >+ } >+ >+ protected JavaSourceViewer createJavaSourceViewer(Composite parent, IVerticalRuler verticalRuler, IOverviewRuler overviewRuler, boolean isOverviewRulerVisible, int styles, >+ IPreferenceStore store) { >+ return super.createJavaSourceViewer(parent, verticalRuler, overviewRuler, false, styles|fTextOrientation, store); >+ } >+ >+ protected void doSetInput(IEditorInput input) throws CoreException { >+ super.doSetInput(input); >+ // the editor input has been explicitly set >+ fInputSet = true; >+ } >+ // called by org.eclipse.ui.texteditor.TextEditorAction.canModifyEditor() >+ public boolean isEditable() { >+ return fEditable; >+ } >+ public boolean isEditorInputModifiable() { >+ return fEditable; >+ } >+ public boolean isEditorInputReadOnly() { >+ return !fEditable; >+ } >+ protected void setActionsActivated(boolean state) { >+ super.setActionsActivated(state); >+ } >+ public void close(boolean save) { >+ getDocumentProvider().disconnect(getEditorInput()); >+ } >+ protected SourceViewerConfiguration getJavaSourceViewerConfiguration() { >+ return getSourceViewerConfiguration(); >+ } >+ >+ } >+ >+}
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 271787
:
131400
|
131915
|
131916
|
132601
| 132602