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 63214 Details for
Bug 181110
Should SpecfileReconcilingStrategy#updateEditor be empty?
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Update the editor without saving the file
patch.txt (text/plain), 6.34 KB, created by
Alphonse Van Assche
on 2007-04-07 11:25:37 EDT
(
hide
)
Description:
Update the editor without saving the file
Filename:
MIME Type:
Creator:
Alphonse Van Assche
Created:
2007-04-07 11:25:37 EDT
Size:
6.34 KB
patch
obsolete
>Index: src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileCompletionProcessor.java >=================================================================== >--- src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileCompletionProcessor.java (révision 526) >+++ src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileCompletionProcessor.java (copie de travail) >@@ -218,9 +218,9 @@ > private ICompletionProposal[] computeRpmPackageProposals(ITextViewer viewer, > IRegion region, Specfile specfile, String prefix) { > List rpmPkgProposalsList = Activator.getDefault().getRpmPackageList().getProposals(prefix); >- SpecfileElement[] elements = specfile.getSectionsElements(); >- // Show rpm packages proposals only in the preamble section >- if (elements.length == 0 || region.getOffset() < elements[0].getLineEndPosition()) { >+ String currentContentType = sEditor.getInputDocument().getDocumentPartitioner().getContentType(region.getOffset()); >+ // Show only proposals on lines begining with Requires, BuildRequires, etc... >+ if (currentContentType.equals(SpecfilePartitionScanner.SPEC_PACKAGES)) { > if (rpmPkgProposalsList == null) > return new ICompletionProposal[0]; > ArrayList proposals = new ArrayList(); >@@ -253,13 +253,13 @@ > if (elements.length == 0 || offset < elements[0].getLineEndPosition()) { > return Activator.getDefault().getContextTypeRegistry() > .getContextType(PREAMBLE_SECTION_TEMPLATE); >- } else if (offset < elements[1].getLineEndPosition()) { >+ } else if (elements.length == 1 || offset < elements[1].getLineEndPosition()) { > return Activator.getDefault().getContextTypeRegistry() >- .getContextType(PRE_SECTION_TEMPLATE); >- } else if (offset < elements[2].getLineEndPosition()) { >+ .getContextType(PRE_SECTION_TEMPLATE ); >+ } else if (elements.length == 2 || offset < elements[2].getLineEndPosition()) { > return Activator.getDefault().getContextTypeRegistry() > .getContextType(BUILD_SECTION_TEMPLATE); >- } else if (offset < elements[3].getLineEndPosition()) { >+ } else if (elements.length == 3 || offset < elements[3].getLineEndPosition()) { > return Activator.getDefault().getContextTypeRegistry() > .getContextType(INSTALL_SECTION_TEMPLATE); > } else { > >Index: src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileFoldingStructureProvider.java >=================================================================== >--- src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileFoldingStructureProvider.java (révision 526) >+++ src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileFoldingStructureProvider.java (copie de travail) >@@ -48,20 +48,20 @@ > sDocument = document; > } > >- public void updateFoldingRegions(Specfile specfile) { >+ public void updateFoldingRegions() { > try { > ProjectionAnnotationModel model = (ProjectionAnnotationModel) sEditor > .getAdapter(ProjectionAnnotationModel.class); > if (model != null) >- updateFoldingRegions(specfile, model); >+ updateFoldingRegions(model); > } catch (BadLocationException e) { > e.printStackTrace(); > } > } > >- void updateFoldingRegions(Specfile specfile, ProjectionAnnotationModel model) >+ void updateFoldingRegions(ProjectionAnnotationModel model) > throws BadLocationException { >- Set/* <Position> */structure = createFoldingStructure(specfile); >+ Set/* <Position> */structure = createFoldingStructure(sEditor.getSpecfile()); > Annotation[] deletions = computeDifferences(model, structure); > Map/* <Annotation,Position> */additions = computeAdditions(structure); > if ((deletions.length != 0 || additions.size() != 0) >Index: src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java >=================================================================== >--- src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java (révision 526) >+++ src/org/eclipse/linuxtools/rpm/ui/editor/SpecfileReconcilingStrategy.java (copie de travail) >@@ -8,14 +8,13 @@ > import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension; > import org.eclipse.linuxtools.rpm.ui.editor.outline.SpecfileContentOutlinePage; > import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile; >-import org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileParser; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.texteditor.IDocumentProvider; > > public class SpecfileReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension { > > private IDocument sDocument; > private IProgressMonitor sProgressMonitor; >- private SpecfileParser sParser; > private SpecfileFoldingStructureProvider sFoldingStructureProvider; > > SpecfileContentOutlinePage outline; >@@ -28,23 +27,9 @@ > lastRegionOffset = Integer.MAX_VALUE; > this.editor = editor; > documentProvider = editor.getDocumentProvider(); >- sParser= new SpecfileParser(); > sFoldingStructureProvider= new SpecfileFoldingStructureProvider(editor); > } > >- public void reconcile(IRegion partition) { >- try { >- Specfile specfile = editor.getSpecfile(); >- SpecfileParser parser = editor.getParser(); >- if (specfile != null) { >- editor.setSpecfile(parser.parse(documentProvider >- .getDocument(editor.getEditorInput()))); >- outline.update(); >- } >- } catch (Exception e) { >- e.printStackTrace(); >- } >- } > > public void setDocument(IDocument document) { > sDocument= document; >@@ -65,22 +50,34 @@ > } > > private void reconcile() { >- Specfile specfile= parseSpecfile(); >+ Specfile specfile = editor.getSpecfile(); > if (specfile != null) { >- updateEditor(specfile); >- updateFolding(specfile); >+ editor.setSpecfile(editor.getParser().parse(documentProvider >+ .getDocument(editor.getEditorInput()))); >+ outline.update(); >+ updateFolding(); >+ updateEditor(); > } > } >- >- private Specfile parseSpecfile() { >- return sParser.parse(sDocument); >+ >+ public void reconcile(IRegion partition) { >+ reconcile(); > } > >- private void updateEditor(final Specfile specfile) { >+ private void updateEditor() { >+ Shell shell= editor.getSite().getShell(); >+ if (!(shell == null || shell.isDisposed())) { >+ shell.getDisplay().asyncExec(new Runnable() { >+ public void run() { >+ editor.setSpecfile(editor.getParser().parse(documentProvider >+ .getDocument(editor.getEditorInput()))); >+ } >+ }); >+ } > return; > } > >- private void updateFolding(Specfile specfile) { >- sFoldingStructureProvider.updateFoldingRegions(specfile); >+ private void updateFolding() { >+ sFoldingStructureProvider.updateFoldingRegions(); > } > } >
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 181110
:
63214
|
63215
|
63345