use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class IndentAction method performEdits.
@Override
protected void performEdits(final RewriteSessionEditProcessor processor) throws BadLocationException {
MonoReconciler reconciler = ((TTCNPPEditor) getTargetEditor()).getReconciler();
reconciler.setIsIncrementalReconciler(false);
processor.performEdits();
IPreferencesService prefs = Platform.getPreferencesService();
reconciler.setIsIncrementalReconciler(prefs.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.USEINCREMENTALPARSING, false, null));
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class Reconciler method getReconcilerTimeout.
/**
* Gets the reconciler timeout, or in other words the background thread delay.
* This is effective only if DELAYSEMANTICCHECKINGTILLSAVE is off,
* otherwise value is read, but ignored.
* @return the timeout value in milliseconds
*/
private final int getReconcilerTimeout() {
IPreferencesService prefs = Platform.getPreferencesService();
int timeout = prefs.getInt(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.RECONCILERTIMEOUT, 1, null);
return 1000 * timeout;
}
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(getDocument());
getEditor().updateFoldingStructure(positions);
final IFile editedFile = (IFile) editor.getEditorInput().getAdapter(IFile.class);
if (!MarkerHandler.hasMarker(GeneralConstants.ONTHEFLY_SYNTACTIC_MARKER, editedFile)) {
getEditor().refreshOutlinePage();
}
}
});
}
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class ExportProblems method doExportProblems.
private void doExportProblems() {
if (!(selection instanceof IStructuredSelection)) {
return;
}
final IStructuredSelection structSelection = (IStructuredSelection) selection;
if (structSelection.isEmpty()) {
return;
}
final Object firstElement = structSelection.getFirstElement();
if (!(firstElement instanceof IProject)) {
ErrorReporter.logError("The export problems command needs to be called on a project ");
return;
}
final IProject project = (IProject) firstElement;
final IPreferencesService preferencesService = Platform.getPreferencesService();
final boolean reportDebugInformation = preferencesService.getBoolean(ProductConstants.PRODUCT_ID_DESIGNER, PreferenceConstants.DISPLAYDEBUGINFORMATION, true, null);
if (reportDebugInformation) {
TITANDebugConsole.println("Problem markers are to export from " + project.getName());
}
boolean write = false;
String fileName;
final Shell shell = Display.getCurrent().getActiveShell();
do {
final FileDialog dialog = new FileDialog(shell, SWT.SAVE);
dialog.setText("Export problem markers to xls");
dialog.setFilterExtensions(new String[] { "*.xls" });
final IPath path = project.getLocation();
if (path != null) {
dialog.setFilterPath(path.toPortableString());
}
final Calendar now = Calendar.getInstance();
dialog.setFileName("Problems--" + project.getName() + "--" + now.get(Calendar.YEAR) + "-" + (1 + now.get(Calendar.MONTH)) + "-" + now.get(Calendar.DAY_OF_MONTH));
fileName = dialog.open();
if (fileName != null) {
if (new File(fileName).exists()) {
write = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "File exist", "This file already exists. Please confirm overwrite.");
} else {
write = true;
}
} else {
// User cancelled the file dialog, so we have nothing to do
return;
}
} while (!write);
final String fileName2 = fileName;
new ProjectAnalyzerJob("Exporting reported code smells") {
@Override
public IStatus doPostWork(final IProgressMonitor monitor) {
final BaseProblemExporter exporter = new XlsProblemExporter(getProject());
try {
exporter.exportMarkers(monitor, fileName2, Calendar.getInstance().getTime());
if (reportDebugInformation) {
TITANDebugConsole.println("Successfully exported markers to xls");
}
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace("Error while exporting", e);
if (reportDebugInformation) {
TITANDebugConsole.println("Failed to write xls");
}
}
return Status.OK_STATUS;
}
}.quickSchedule(project);
}
use of org.eclipse.core.runtime.preferences.IPreferencesService in project titan.EclipsePlug-ins by eclipse.
the class MinimizeVisibilityRefactoring 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)) {
// FIXME actually all referencing and referenced projects need to be checked too !
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;
}
Aggregations