use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class Configuration method getReconciler.
@Override
public IReconciler getReconciler(final ISourceViewer sourceViewer) {
if (reconciler == null) {
ReconcilingStrategy strategy = new ReconcilingStrategy();
strategy.setEditor(editor);
strategy.analyze();
reconciler = new MonoReconciler(strategy, false);
reconciler.setProgressMonitor(new NullProgressMonitor());
IPreferencesService prefs = Platform.getPreferencesService();
int timeout = prefs.getInt(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.RECONCILERTIMEOUT, 1, null);
reconciler.setDelay(timeout * 1000);
}
return reconciler;
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class DocumentSetupParticipant method setup.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.
* eclipse.jface.text.IDocument)
*/
@Override
public void setup(final IDocument document) {
EditorTracker.remove(editor);
EditorTracker.put((IFile) editor.getEditorInput().getAdapter(IFile.class), editor);
DocumentTracker.put((IFile) editor.getEditorInput().getAdapter(IFile.class), document);
IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(), PartitionScanner.PARTITION_TYPES);
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(PartitionScanner.ASN1_PARTITIONING, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
document.addDocumentListener(new IDocumentListener() {
@Override
public void documentAboutToBeChanged(final DocumentEvent event) {
GlobalIntervalHandler.putInterval(event.getDocument(), null);
}
@Override
public void documentChanged(final DocumentEvent event) {
IPreferencesService prefs = Platform.getPreferencesService();
if (prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEONTHEFLYPARSING, true, null)) {
analyze(document, false);
}
}
});
analyze(document, true);
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class ConfigReferenceParser method findReferenceForOpening.
@Override
public Reference findReferenceForOpening(final IFile file, final int offset, final IDocument document) {
Reference reference = null;
int ofs = offset - 1;
int endoffset = offset;
if (-1 == offset) {
return reference;
}
try {
int tempOfs = referenceStartOffset(ofs, document);
if (-1 == tempOfs) {
return reference;
}
ofs = tempOfs + 1;
char currentChar = document.getChar(endoffset);
while (endoffset < document.getLength()) {
if (!Character.isLetterOrDigit(currentChar) && currentChar != '*' && currentChar != '_' && currentChar != '.') {
break;
}
currentChar = document.getChar(++endoffset);
}
if (!moduleParameter) {
defineName = document.get(ofs, endoffset - ofs);
return null;
}
String selected = document.get(ofs, endoffset - ofs);
String parameter = selected;
int dotIndex = selected.indexOf('.');
if (dotIndex > 0) {
String moduleName = selected.substring(0, dotIndex);
if (!"*".equals(moduleName)) {
exactModuleName = moduleName;
IPreferencesService prefs = Platform.getPreferencesService();
if (prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, true, null)) {
TITANDebugConsole.println("Module: " + exactModuleName);
}
}
parameter = selected.substring(dotIndex + 1);
}
TTCN3ReferenceAnalyzer refAnalyzer = new TTCN3ReferenceAnalyzer();
reference = refAnalyzer.parse(file, parameter, reportErrors, document.getLineOfOffset(ofs) + 1, ofs);
} catch (BadLocationException e) {
ErrorReporter.logExceptionStackTrace(e);
}
return reference;
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class InsertFieldRefactoring method checkInitialConditions.
@Override
public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
final RefactoringStatus result = new RefactoringStatus();
try {
pm.beginTask("Checking preconditions...", 2);
// PreferenceConstants.USEONTHEFLYPARSING
final IPreferencesService prefs = Platform.getPreferencesService();
if (!prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEONTHEFLYPARSING, false, null)) {
result.addError(ONTHEFLYANALAYSISDISABLED);
}
// project
for (IProject project : projects) {
if (hasTtcnppFiles(project)) {
result.addError(MessageFormat.format(PROJECTCONTAINSTTCNPPFILES, project));
}
}
pm.worked(1);
// project
for (IProject project : projects) {
final IMarker[] markers = project.findMarkers(null, true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
if (IMarker.SEVERITY_ERROR == marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR)) {
result.addError(MessageFormat.format(PROJECTCONTAINSERRORS, project));
break;
}
}
}
pm.worked(1);
} catch (CoreException e) {
ErrorReporter.logExceptionStackTrace(e);
result.addFatalError(e.getMessage());
} finally {
pm.done();
}
return result;
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class ReconcilingStrategy method fullReconciliation.
private void fullReconciliation(final boolean isInitial) {
actualCode = new StringBuilder(document.get());
GlobalIntervalHandler.putInterval(document, null);
IPreferencesService prefs = Platform.getPreferencesService();
if (prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEONTHEFLYPARSING, true, null)) {
analyze(isInitial);
} else {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
List<Position> positions = (new TTCN3FoldingSupport()).calculatePositions(document);
editor.updateFoldingStructure(positions);
editor.updateOutlinePage();
}
});
}
}
Aggregations