Lines 14-19
Link Here
|
14 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
15 |
import java.util.HashMap; |
15 |
import java.util.HashMap; |
16 |
import java.util.Map; |
16 |
import java.util.Map; |
|
|
17 |
import java.util.Set; |
17 |
|
18 |
|
18 |
import org.eclipse.cdt.core.CCorePlugin; |
19 |
import org.eclipse.cdt.core.CCorePlugin; |
19 |
import org.eclipse.cdt.core.model.CModelException; |
20 |
import org.eclipse.cdt.core.model.CModelException; |
Lines 31-36
Link Here
|
31 |
import org.eclipse.cdt.core.model.IUsing; |
32 |
import org.eclipse.cdt.core.model.IUsing; |
32 |
import org.eclipse.cdt.core.model.IWorkingCopy; |
33 |
import org.eclipse.cdt.core.model.IWorkingCopy; |
33 |
import org.eclipse.cdt.core.model.LanguageManager; |
34 |
import org.eclipse.cdt.core.model.LanguageManager; |
|
|
35 |
import org.eclipse.cdt.core.model.addl_langs.IContributedModelBuilder; |
34 |
import org.eclipse.core.resources.IFile; |
36 |
import org.eclipse.core.resources.IFile; |
35 |
import org.eclipse.core.resources.IResource; |
37 |
import org.eclipse.core.resources.IResource; |
36 |
import org.eclipse.core.runtime.CoreException; |
38 |
import org.eclipse.core.runtime.CoreException; |
Lines 279-285
Link Here
|
279 |
return location; |
281 |
return location; |
280 |
} |
282 |
} |
281 |
|
283 |
|
282 |
protected IFile getFile() { |
284 |
public IFile getFile() { |
283 |
IResource res = getResource(); |
285 |
IResource res = getResource(); |
284 |
if (res instanceof IFile) { |
286 |
if (res instanceof IFile) { |
285 |
return (IFile)res; |
287 |
return (IFile)res; |
Lines 580-589
Link Here
|
580 |
/** |
582 |
/** |
581 |
* Parse the buffer contents of this element. |
583 |
* Parse the buffer contents of this element. |
582 |
*/ |
584 |
*/ |
583 |
private void parse(Map newElements){ |
585 |
private void parse(Map newElements) { |
|
|
586 |
boolean quickParseMode = ! (CCorePlugin.getDefault().useStructuralParseMode()); |
587 |
IContributedModelBuilder mb = LanguageManager.getInstance().getContributedModelBuilderFor(this); |
588 |
if (mb == null) { |
589 |
parseUsingCModelBuilder(newElements, quickParseMode); |
590 |
} else { |
591 |
parseUsingContributedModelBuilder(mb, quickParseMode); |
592 |
} |
593 |
} |
594 |
|
595 |
/** |
596 |
* Parse the buffer contents of this element. |
597 |
*/ |
598 |
private void parseUsingCModelBuilder(Map newElements, boolean quickParseMode) { |
584 |
try { |
599 |
try { |
585 |
CModelBuilder modelBuilder = new CModelBuilder(this, newElements); |
600 |
CModelBuilder modelBuilder = new CModelBuilder(this, newElements); |
586 |
boolean quickParseMode = ! (CCorePlugin.getDefault().useStructuralParseMode()); |
|
|
587 |
modelBuilder.parse(quickParseMode); |
601 |
modelBuilder.parse(quickParseMode); |
588 |
} catch (Exception e) { |
602 |
} catch (Exception e) { |
589 |
// use the debug log for this exception. |
603 |
// use the debug log for this exception. |
Lines 591-596
Link Here
|
591 |
} |
605 |
} |
592 |
} |
606 |
} |
593 |
|
607 |
|
|
|
608 |
private void parseUsingContributedModelBuilder(IContributedModelBuilder mb, boolean quickParseMode) { |
609 |
try { |
610 |
mb.parse(quickParseMode); |
611 |
} catch (Exception e) { |
612 |
// use the debug log for this exception. |
613 |
Util.debugLog( "Exception in contributed model builder", IDebugLogConstants.MODEL); //$NON-NLS-1$ |
614 |
} |
615 |
} |
616 |
|
594 |
public IProblemRequestor getProblemRequestor() { |
617 |
public IProblemRequestor getProblemRequestor() { |
595 |
return problemRequestor; |
618 |
return problemRequestor; |
596 |
} |
619 |
} |
Lines 613-618
Link Here
|
613 |
CCorePlugin.CONTENT_TYPE_CSOURCE.equals(contentTypeId) |
636 |
CCorePlugin.CONTENT_TYPE_CSOURCE.equals(contentTypeId) |
614 |
|| CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(contentTypeId) |
637 |
|| CCorePlugin.CONTENT_TYPE_CXXSOURCE.equals(contentTypeId) |
615 |
|| CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(contentTypeId) |
638 |
|| CCorePlugin.CONTENT_TYPE_ASMSOURCE.equals(contentTypeId) |
|
|
639 |
|| LanguageManager.getInstance().isContributedContentType(contentTypeId) |
616 |
); |
640 |
); |
617 |
} |
641 |
} |
618 |
|
642 |
|
Lines 695-698
Link Here
|
695 |
} |
719 |
} |
696 |
super.closing(info); |
720 |
super.closing(info); |
697 |
} |
721 |
} |
|
|
722 |
|
723 |
/** |
724 |
* Contributed languages' model builders need to be able to indicate whether or |
725 |
* not the parse of a translation unit was successful without having access to |
726 |
* the <code>CElementInfo</code> object associated with the translation unit |
727 |
* |
728 |
* @param wasSuccessful |
729 |
* @throws CModelException |
730 |
*/ |
731 |
public void setIsStructureKnown(boolean wasSuccessful) { |
732 |
try { |
733 |
this.getElementInfo().setIsStructureKnown(wasSuccessful); |
734 |
} catch (CModelException e) { |
735 |
; |
736 |
} |
737 |
} |
698 |
} |
738 |
} |