]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/propertiesfileeditor/PropertiesCorrectionAssistant.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / propertiesfileeditor / PropertiesCorrectionAssistant.java
1 /*******************************************************************************
2  * Copyright (c) 2010, 2011 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.ui.propertiesfileeditor;
12
13 import org.eclipse.swt.widgets.Shell;
14
15 import org.eclipse.core.runtime.Assert;
16
17 import org.eclipse.jface.text.DefaultInformationControl;
18 import org.eclipse.jface.text.IInformationControl;
19 import org.eclipse.jface.text.IInformationControlCreator;
20 import org.eclipse.jface.text.quickassist.QuickAssistAssistant;
21
22 import org.eclipse.ui.IEditorPart;
23 import org.eclipse.ui.IWorkbenchPreferenceConstants;
24 import org.eclipse.ui.PlatformUI;
25
26 import org.eclipse.ui.texteditor.ITextEditor;
27
28 import org.eclipse.jdt.internal.ui.JavaPlugin;
29
30 /**
31  * The properties file correction assistant.
32  * 
33  * @since 3.7
34  */
35 public class PropertiesCorrectionAssistant extends QuickAssistAssistant {
36
37         private ITextEditor fEditor;
38
39         public PropertiesCorrectionAssistant(ITextEditor editor) {
40                 super();
41                 Assert.isNotNull(editor);
42                 fEditor= editor;
43
44                 setQuickAssistProcessor(new PropertiesCorrectionProcessor(this));
45                 enableColoredLabels(PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.USE_COLORED_LABELS));
46
47                 setInformationControlCreator(getInformationControlCreator());
48         }
49
50         private IInformationControlCreator getInformationControlCreator() {
51                 return new IInformationControlCreator() {
52                         public IInformationControl createInformationControl(Shell parent) {
53                                 return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString());
54                         }
55                 };
56         }
57
58         public IEditorPart getEditor() {
59                 return fEditor;
60         }
61 }