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 161947 Details for
Bug 305390
encoding change event is not handled.
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.
Updated patch, apply to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests
rdt.core-rdt.core.tests_patch.txt (text/plain), 11.40 KB, created by
John Liu
on 2010-03-12 18:41:22 EST
(
hide
)
Description:
Updated patch, apply to org.eclipse.ptp.rdt.core, org.eclipse.ptp.rdt.core.tests
Filename:
MIME Type:
Creator:
John Liu
Created:
2010-03-12 18:41:22 EST
Size:
11.40 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ptp.rdt.core.tests >Index: miner/org/eclipse/ptp/rdt/core/tests/miner/StandaloneIndexerTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core.tests/miner/org/eclipse/ptp/rdt/core/tests/miner/StandaloneIndexerTest.java,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 StandaloneIndexerTest.java >--- miner/org/eclipse/ptp/rdt/core/tests/miner/StandaloneIndexerTest.java 16 Jun 2009 19:05:28 -0000 1.1.2.2 >+++ miner/org/eclipse/ptp/rdt/core/tests/miner/StandaloneIndexerTest.java 12 Mar 2010 23:32:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 IBM Corporation 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 >@@ -106,7 +106,7 @@ > Map<String,String> macroDefinitions = Collections.emptyMap(); > IScannerInfo scannerInfo = new ScannerInfo(macroDefinitions, includePaths); > >- StandaloneFastIndexer indexer = new StandaloneFastIndexer(indexFile, locationConverter, linkageFactoryMap, null, LOG); >+ StandaloneFastIndexer indexer = new StandaloneFastIndexer(indexFile, locationConverter, linkageFactoryMap, null, null, LOG); > indexer.setScannerInfoProvider(new DirtSimpleScannerInfoProvider(scannerInfo)); > indexer.setLanguageMapper(mapper); > indexer.setTraceStatistics(true); >#P org.eclipse.ptp.rdt.core >Index: src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProviderFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProviderFactory.java,v >retrieving revision 1.1.2.4 >diff -u -r1.1.2.4 RemoteIndexerInfoProviderFactory.java >--- src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProviderFactory.java 23 Oct 2009 23:29:39 -0000 1.1.2.4 >+++ src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProviderFactory.java 12 Mar 2010 23:32:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 IBM Corporation 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 >@@ -30,6 +30,7 @@ > import org.eclipse.cdt.core.model.LanguageManager; > import org.eclipse.cdt.core.parser.IScannerInfo; > import org.eclipse.cdt.core.parser.IScannerInfoProvider; >+import org.eclipse.cdt.internal.core.parser.util.FileEncodingRegistry; > import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; > import org.eclipse.cdt.utils.FileSystemUtilityManager; > import org.eclipse.core.resources.IFile; >@@ -252,6 +253,14 @@ > > RemoteScannerInfoCache cache = new RemoteScannerInfoCache(); > >+ FileEncodingRegistry fileEncodingRegistry =null; >+ try { >+ fileEncodingRegistry = new FileEncodingRegistry(project.getDefaultCharset()); >+ } catch (CoreException e1) { >+ >+ RDTLog.logError(e1); >+ } >+ > for(ICElement element : elements) { > if(element instanceof ITranslationUnit) { > ITranslationUnit tu = (ITranslationUnit) element; >@@ -271,12 +280,18 @@ > if(!languagePropertyMap.containsKey(id)) > languagePropertyMap.put(id, getLanguageProperties(id, project)); > >+ if(fileEncodingRegistry!=null){ >+ registerFileEncoding(fileEncodingRegistry, element); >+ } >+ > } catch (CoreException e) { > RDTLog.logError(e); > } > > if(tu.isHeaderUnit()) > headerSet.add(path); >+ >+ > } > } > >@@ -306,10 +321,33 @@ > } > > return new RemoteIndexerInfoProvider(scannerInfoMap, linkageMap, languageMap, languagePropertyMap, >- headerSet, preferences, filesToParseUpFront); >+ headerSet, preferences, filesToParseUpFront, fileEncodingRegistry); > } > > >+ private static void registerFileEncoding(FileEncodingRegistry fileEncodingRegistry, ICElement element) throws CoreException { >+ >+ String filePath = null; >+ String specificEncoding = null; >+ >+ // if it's a translation unit, we can just add it >+ if (element instanceof ITranslationUnit) { >+ // get remote file path with encoding >+ filePath = FileSystemUtilityManager.getDefault().getPathFromURI(element.getLocationURI()); >+ IResource resource = ((ITranslationUnit) element).getResource(); >+ >+ if (resource instanceof IFile) { >+ >+ specificEncoding = ((IFile) resource).getCharset(false); >+ >+ } >+ >+ } >+ >+ if (filePath != null && specificEncoding!=null) { >+ fileEncodingRegistry.registerFileEncoding(filePath, specificEncoding); >+ } >+ } > > private static Set<String> computeIndexerPreferences(Properties props) { > Set<String> prefs = new HashSet<String>(props.size()); >Index: src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProvider.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProvider.java,v >retrieving revision 1.1.2.3 >diff -u -r1.1.2.3 RemoteIndexerInfoProvider.java >--- src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProvider.java 23 Oct 2009 01:59:20 -0000 1.1.2.3 >+++ src/org/eclipse/ptp/internal/rdt/core/RemoteIndexerInfoProvider.java 12 Mar 2010 23:32:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2009 IBM Corporation and others. >+ * Copyright (c) 2009, 2010 IBM Corporation 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 >@@ -22,6 +22,7 @@ > import java.util.Set; > > import org.eclipse.cdt.core.parser.IScannerInfo; >+import org.eclipse.cdt.internal.core.parser.util.FileEncodingRegistry; > > /** > * Holds on to info that is needed by the remote indexer. >@@ -42,7 +43,7 @@ > private Set<String> headerSet; // (path -> isHeaderUnit(boolean)) > private Set<String> indexerPreferences; // (preference key -> boolean) > private List<String> filesToParseUpFront; >- >+ private FileEncodingRegistry fFileEncodingRegistry; > > // > RemoteIndexerInfoProvider() { } >@@ -53,7 +54,8 @@ > Map<String, Map<String,String>> languagePropertyMap, > Set<String> headerSet, > Set<String> indexerPreferences, >- List<String> filesToParseUpFront) { >+ List<String> filesToParseUpFront, >+ FileEncodingRegistry fileEncodingRegistry) { > > this.pathMap = pathMap; > this.linkageMap = linkageMap; >@@ -62,6 +64,7 @@ > this.headerSet = headerSet; > this.indexerPreferences = indexerPreferences; > this.filesToParseUpFront = filesToParseUpFront; >+ this.fFileEncodingRegistry = fileEncodingRegistry; > } > > >@@ -133,6 +136,9 @@ > return languagePropertyMap.get(languageId); > } > >+ public FileEncodingRegistry getFileEncodingRegistry() { >+ return fFileEncodingRegistry; >+ } > > public String toString() { > return "pathMap:" + pathMap + //$NON-NLS-1$ >@@ -141,7 +147,8 @@ > " languagePropertyMap" + languagePropertyMap + //$NON-NLS-1$ > " isHeaderMap:" + headerSet + //$NON-NLS-1$ > " preferences: " + indexerPreferences + //$NON-NLS-1$ >- " filesToParseUpFront: " + filesToParseUpFront; //$NON-NLS-1$ >+ " filesToParseUpFront: " + filesToParseUpFront + //$NON-NLS-1$ >+ " fFileEncodingRegistry: " + fFileEncodingRegistry; //$NON-NLS-1$ > } > > } >Index: src/org/eclipse/ptp/internal/rdt/core/IRemoteIndexerInfoProvider.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/src/org/eclipse/ptp/internal/rdt/core/IRemoteIndexerInfoProvider.java,v >retrieving revision 1.1.2.3 >diff -u -r1.1.2.3 IRemoteIndexerInfoProvider.java >--- src/org/eclipse/ptp/internal/rdt/core/IRemoteIndexerInfoProvider.java 23 Oct 2009 01:59:20 -0000 1.1.2.3 >+++ src/org/eclipse/ptp/internal/rdt/core/IRemoteIndexerInfoProvider.java 12 Mar 2010 23:32:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2009 IBM Corporation and others. >+ * Copyright (c) 2008, 2010 IBM Corporation 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 >@@ -15,6 +15,7 @@ > > import org.eclipse.cdt.core.model.ILanguage; > import org.eclipse.cdt.internal.core.indexer.IStandaloneScannerInfoProvider; >+import org.eclipse.cdt.internal.core.parser.util.FileEncodingRegistry; > import org.eclipse.cdt.internal.core.pdom.indexer.IndexerPreferences; > import org.eclipse.ptp.rdt.core.ILanguagePropertyProvider; > >@@ -75,5 +76,11 @@ > * @see ILanguage > */ > Map<String,String> getLanguageProperties(String languageId); >+ >+ /** >+ * >+ * @return the fileEncodingRegistry >+ */ >+ FileEncodingRegistry getFileEncodingRegistry(); > } > >Index: miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteIndexManager.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.core/miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteIndexManager.java,v >retrieving revision 1.2.2.9 >diff -u -r1.2.2.9 RemoteIndexManager.java >--- miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteIndexManager.java 27 Oct 2009 16:31:13 -0000 1.2.2.9 >+++ miners/org/eclipse/ptp/internal/rdt/core/miners/RemoteIndexManager.java 12 Mar 2010 23:32:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2009 IBM Corporation and others. >+ * Copyright (c) 2007, 2010 IBM Corporation 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 >@@ -109,6 +109,7 @@ > indexer.setScannerInfoProvider(provider); > indexer.setLanguageMapper(new RemoteLanguageMapper(provider, dataStore)); > indexer.setFilesToParseUpFront(provider.getFilesToParseUpFront().toArray(new String[]{})); >+ indexer.setFileEncodingRegistry(provider.getFileEncodingRegistry()); > > if(provider.checkIndexerPreference(IRemoteIndexerInfoProvider.KEY_SKIP_ALL_REFERENCES)) { > indexer.setSkipReferences(PDOMWriter.SKIP_ALL_REFERENCES); >@@ -188,7 +189,7 @@ > > try { > IParserLogService LOG = new RemoteLogService(dataStore, status); >- indexer = new StandaloneFastIndexer(indexFile, locationConverter, linkageFactoryMap, null, LOG); >+ indexer = new StandaloneFastIndexer(indexFile, locationConverter, linkageFactoryMap, null, null, LOG); > > scopeToIndexerMap.put(scope, indexer); > } catch (CoreException e) {
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 Raw
Actions:
View
Attachments on
bug 305390
:
161659
|
161756
| 161947