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 80237 Details for
Bug 190418
[Patch] Provide a patch file editor with Outline
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch proposal
patch_190418_20071012.txt (text/plain), 9.11 KB, created by
Tomasz Zarna
on 2007-10-12 11:30:01 EDT
(
hide
)
Description:
Patch proposal
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2007-10-12 11:30:01 EDT
Size:
9.11 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugin.xml,v >retrieving revision 1.65 >diff -u -r1.65 plugin.xml >--- plugin.xml 11 Jul 2007 14:59:33 -0000 1.65 >+++ plugin.xml 12 Oct 2007 15:28:01 -0000 >@@ -83,6 +83,17 @@ > class="org.eclipse.compare.internal.CompareEditor" > id="org.eclipse.compare.CompareEditor"> > </editor> >+ <editor >+ class="org.eclipse.compare.internal.patch.PatchEditor" >+ contributorClass="org.eclipse.compare.internal.patch.PatchEditorActionContributor" >+ default="false" >+ icon="icons/full/eview16/sample.gif" >+ id="org.eclipse.compare.PatchEditor" >+ name="Patch File Editor"> >+ <contentTypeBinding >+ contentTypeId="org.eclipse.compare.patchContentType"> >+ </contentTypeBinding> >+ </editor> > </extension> > > <extension >@@ -330,5 +341,16 @@ > class="org.eclipse.compare.internal.ComparePreferenceInitializer"> > </initializer> > </extension> >+ <extension >+ point="org.eclipse.core.runtime.contentTypes"> >+ <content-type >+ base-type="org.eclipse.core.runtime.text" >+ describer="org.eclipse.compare.internal.patch.PatchContentDescriber" >+ file-extensions="txt" >+ id="org.eclipse.compare.patchContentType" >+ name="Patch" >+ priority="high"> >+ </content-type> >+ </extension> > > </plugin> >Index: compare/org/eclipse/compare/internal/patch/PatchContentDescriber.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/patch/PatchContentDescriber.java >diff -N compare/org/eclipse/compare/internal/patch/PatchContentDescriber.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/patch/PatchContentDescriber.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,51 @@ >+package org.eclipse.compare.internal.patch; >+ >+import java.io.BufferedReader; >+import java.io.IOException; >+import java.io.InputStream; >+import java.io.InputStreamReader; >+ >+import org.eclipse.compare.internal.CompareUIPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.QualifiedName; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.core.runtime.content.IContentDescriber; >+import org.eclipse.core.runtime.content.IContentDescription; >+ >+public class PatchContentDescriber implements IContentDescriber { >+ >+ public int describe(final InputStream contents, >+ IContentDescription description) throws IOException { >+ try { >+ BufferedReader reader = new BufferedReader(new InputStreamReader( >+ contents)); >+ try { >+ PatchReader patchReader = new PatchReader(); >+ patchReader.parse(reader); >+ // TODO (tzarna): creates outline only for workspace patches >+ if (patchReader.isWorkspacePatch()) >+ return VALID; >+ } catch (IOException e) { >+ throw new CoreException(new Status(IStatus.ERROR, >+ CompareUIPlugin.PLUGIN_ID, 0, e.getMessage(), e)); >+ } finally { >+ try { >+ reader.close(); >+ } catch (IOException e) { // ignored >+ } >+ } >+ >+ } catch (CoreException e) { >+ return INDETERMINATE; >+ } >+ >+ return INDETERMINATE; >+ } >+ >+ public QualifiedName[] getSupportedOptions() { >+ // TODO Auto-generated method stub >+ return null; >+ } >+ >+} >Index: compare/org/eclipse/compare/internal/patch/PatchEditorActionContributor.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/patch/PatchEditorActionContributor.java >diff -N compare/org/eclipse/compare/internal/patch/PatchEditorActionContributor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/patch/PatchEditorActionContributor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+package org.eclipse.compare.internal.patch; >+ >+import org.eclipse.ui.editors.text.TextEditorActionContributor; >+ >+public class PatchEditorActionContributor extends TextEditorActionContributor { >+ >+ public PatchEditorActionContributor() { >+ // TODO Auto-generated constructor stub >+ } >+} >Index: compare/org/eclipse/compare/internal/patch/PatchContentOutlinePage.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/patch/PatchContentOutlinePage.java >diff -N compare/org/eclipse/compare/internal/patch/PatchContentOutlinePage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/patch/PatchContentOutlinePage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,103 @@ >+package org.eclipse.compare.internal.patch; >+ >+import java.io.IOException; >+ >+import org.eclipse.compare.CompareConfiguration; >+import org.eclipse.compare.structuremergeviewer.DiffTreeViewer; >+import org.eclipse.core.resources.IStorage; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.jface.action.IMenuManager; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.ISelectionChangedListener; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.ui.IEditorInput; >+import org.eclipse.ui.part.FileEditorInput; >+import org.eclipse.ui.part.Page; >+import org.eclipse.ui.texteditor.IDocumentProvider; >+import org.eclipse.ui.views.contentoutline.IContentOutlinePage; >+ >+public class PatchContentOutlinePage extends Page implements >+IContentOutlinePage/*, ISelectionChangedListener*/ { >+ DiffTreeViewer treeViewer; >+ IEditorInput fInput; >+ private ListenerList selectionChangedListeners = new ListenerList(); >+ private WorkspacePatcher fPatcher; >+ >+ public PatchContentOutlinePage(IDocumentProvider documentProvider, >+ PatchEditor patchEditor) { >+ // TODO Auto-generated constructor stub >+ } >+ >+ public void setInput(IEditorInput editorInput) { >+ fInput = editorInput; >+ } >+ >+ public void createControl(Composite parent) { >+ getPatcher(); >+ CompareConfiguration patchConfiguration = new CompareConfiguration(); >+ PatchCompareEditorInput editorInput = new PatchCompareEditorInput( >+ fPatcher, patchConfiguration) { >+ protected void fillContextMenu(IMenuManager manager) { >+ // TODO Auto-generated method stub >+ } >+ }; >+ treeViewer = (DiffTreeViewer) editorInput.createDiffViewer(parent); >+ editorInput.buildTree(); >+ } >+ >+ private WorkspacePatcher getPatcher() { >+ if (fPatcher == null) { >+ if (fInput instanceof FileEditorInput) { >+ IStorage patch = ((FileEditorInput) fInput).getStorage(); >+ WorkspacePatcher patcher = new WorkspacePatcher(); >+ if (patch != null) { >+ try { >+ patcher.parse(patch); >+ } catch (IOException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } catch (CoreException e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ fPatcher = patcher; >+ } >+ } >+ } >+ return fPatcher; >+ } >+ >+ public Control getControl() { >+ if (treeViewer == null) { >+ return null; >+ } >+ return treeViewer.getControl(); >+ } >+ >+ public void setFocus() { >+ treeViewer.getControl().setFocus(); >+ } >+ >+ public void addSelectionChangedListener(ISelectionChangedListener listener) { >+ selectionChangedListeners.add(listener); >+ } >+ >+ public ISelection getSelection() { >+ if (treeViewer == null) { >+ return StructuredSelection.EMPTY; >+ } >+ return treeViewer.getSelection(); >+ } >+ >+ public void removeSelectionChangedListener( >+ ISelectionChangedListener listener) { >+ // TODO Auto-generated method stub >+ } >+ >+ public void setSelection(ISelection selection) { >+ // TODO Auto-generated method stub >+ } >+} >Index: compare/org/eclipse/compare/internal/patch/PatchEditor.java >=================================================================== >RCS file: compare/org/eclipse/compare/internal/patch/PatchEditor.java >diff -N compare/org/eclipse/compare/internal/patch/PatchEditor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ compare/org/eclipse/compare/internal/patch/PatchEditor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+package org.eclipse.compare.internal.patch; >+ >+import org.eclipse.ui.editors.text.TextEditor; >+import org.eclipse.ui.views.contentoutline.IContentOutlinePage; >+ >+public class PatchEditor extends TextEditor { >+ >+ private PatchContentOutlinePage fOutlinePage; >+ >+ public PatchEditor() { >+ // TODO Auto-generated constructor stub >+ } >+ >+ public Object getAdapter(Class required) { >+ if (IContentOutlinePage.class.equals(required)) { >+ if (fOutlinePage == null) { >+ fOutlinePage = new PatchContentOutlinePage( >+ getDocumentProvider(), this); >+ if (getEditorInput() != null) >+ fOutlinePage.setInput(getEditorInput()); >+ } >+ return fOutlinePage; >+ } >+ return super.getAdapter(required); >+ } >+ >+}
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 190418
: 80237