List of usage examples for org.eclipse.jface.preference PreferenceStore PreferenceStore
public PreferenceStore()
From source file:org.eclipse.dltk.ruby.ui.tests.indenting.RubyAutoIndentStrategyTest.java
License:Open Source License
@Override protected void setUp() throws Exception { super.setUp(); fStore = new PreferenceStore(); RubyPreferenceConstants.initializeDefaultValues(fStore); fStore.setValue(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB); fStore.setValue(PreferenceConstants.EDITOR_CLOSE_BRACES, true); fStore.setValue(PreferenceConstants.EDITOR_SMART_PASTE, true); fStore.setValue(PreferenceConstants.EDITOR_SMART_INDENT, true); String fPartitioning = IRubyPartitions.RUBY_PARTITIONING; strategy = new RubyAutoEditStrategy(fPartitioning, fStore); }
From source file:org.eclipse.dltk.ruby.ui.tests.text.indenting.IndentingTest.java
License:Open Source License
private RubyAutoEditStrategy createStrategy(boolean useTabs) { PreferenceStore store = new PreferenceStore(); RubyPreferenceConstants.initializeDefaultValues(store); store.setValue(CodeFormatterConstants.FORMATTER_TAB_CHAR, (useTabs ? CodeFormatterConstants.TAB : CodeFormatterConstants.SPACE)); store.setValue(PreferenceConstants.EDITOR_CLOSE_BRACES, false); String partitioning = IRubyPartitions.RUBY_PARTITIONING; RubyAutoEditStrategy result = new RubyAutoEditStrategy(partitioning, store); return result; }
From source file:org.eclipse.edt.ide.ui.internal.handlers.wizards.NewHandlerSummaryPage.java
License:Open Source License
/** * @see IDialogPage#createControl(Composite) *//* ww w. j ava 2 s .co m*/ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); // TODO change help // PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IUIHelpConstants.EGL_NEW_HANDLER_SUMMARY_PAGE); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 1; Label label = new Label(container, SWT.HORIZONTAL); label.setText(NewHandlerWizardMessages.NewHandlerSummaryPage_previewLabel); TextTools tools = new TextTools(new PreferenceStore()); fPreviewViewer = new SourceViewer(container, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fPreviewViewer.configure(new EGLSourceViewerConfiguration(tools, null)); Font font = JFaceResources.getFont(EGLPreferenceConstants.EDITOR_TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); fPreviewViewer.setEditable(false); fPreviewViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); document = new Document(""); IDocumentPartitioner partitioner = ((DocumentProvider) EGLUI.getDocumentProvider()) .createDocumentPartitioner(); document.setDocumentPartitioner(partitioner); partitioner.connect(document); fPreviewViewer.setDocument(document); messageComposite = new HideableComposite(container, 0); layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; messageComposite.setLayout(layout); messageComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); warningLabel = new Label(messageComposite, SWT.HORIZONTAL); warningLabel.setText(NewHandlerWizardMessages.NewHandlerSummaryPage_warningLabel); warningLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); messageList = new Table(messageComposite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); messageList.setLinesVisible(false); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 80; messageList.setLayoutData(data); setControl(container); setContent(content); }
From source file:org.eclipse.edt.ide.ui.internal.record.NewRecordSummaryPage.java
License:Open Source License
/** * @see IDialogPage#createControl(Composite) */// www .j a v a2s . c o m public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IUIHelpConstants.EGL_NEW_RECORD_SUMMARY_PAGE); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 1; Label label = new Label(container, SWT.HORIZONTAL); label.setText(NewRecordWizardMessages.NewRecordSummaryPage_previewLabel); TextTools tools = new TextTools(new PreferenceStore()); fPreviewViewer = new SourceViewer(container, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fPreviewViewer.configure(new EGLSourceViewerConfiguration(tools, null)); Font font = JFaceResources.getFont(EGLPreferenceConstants.EDITOR_TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); fPreviewViewer.setEditable(false); fPreviewViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); document = new Document(""); IDocumentPartitioner partitioner = ((DocumentProvider) EGLUI.getDocumentProvider()) .createDocumentPartitioner(); document.setDocumentPartitioner(partitioner); partitioner.connect(document); fPreviewViewer.setDocument(document); messageComposite = new HideableComposite(container, 0); layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; messageComposite.setLayout(layout); messageComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); warningLabel = new Label(messageComposite, SWT.HORIZONTAL); warningLabel.setText(NewRecordWizardMessages.NewRecordSummaryPage_warningLabel); warningLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); messageList = new Table(messageComposite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); messageList.setLinesVisible(false); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 80; messageList.setLayoutData(data); setControl(container); }
From source file:org.eclipse.edt.ide.ui.internal.wizards.EGLCodePreviewPage.java
License:Open Source License
/** * @see IDialogPage#createControl(Composite) *///w ww . ja v a 2s . c o m public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); PlatformUI.getWorkbench().getHelpSystem().setHelp(container, IUIHelpConstants.EGL_NEW_RECORD_SUMMARY_PAGE); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 1; codeViewerSelectorContainer = new Composite(container, SWT.NULL); codeViewerSelectorContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout codeViewerSelectorContainerLayout = new GridLayout(2, false); codeViewerSelectorContainerLayout.marginWidth = 0; codeViewerSelectorContainer.setLayout(codeViewerSelectorContainerLayout); TextTools tools = new TextTools(new PreferenceStore()); fPreviewViewer = new SourceViewer(container, null, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); fPreviewViewer.configure(new EGLSourceViewerConfiguration(tools, null)); Font font = JFaceResources.getFont(EGLPreferenceConstants.EDITOR_TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); fPreviewViewer.setEditable(false); fPreviewViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); messageComposite = new HideableComposite(container, 0); layout = new GridLayout(1, false); layout.marginHeight = 0; layout.marginWidth = 0; messageComposite.setLayout(layout); messageComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); warningLabel = new Label(messageComposite, SWT.HORIZONTAL); warningLabel.setText(NewWizardMessages.NewEGLFilesPreviewPage_warningLabel); warningLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); messageList = new Table(messageComposite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); messageList.setLinesVisible(false); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.heightHint = 80; messageList.setLayoutData(data); setControl(container); }
From source file:org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin.java
License:Open Source License
public void start(BundleContext context) throws Exception { super.start(context); PreferencesHint.registerPreferenceStore(PreferencesHint.USE_DEFAULTS, new PreferenceStore()); DiagramEventBroker.registerDiagramEventBrokerFactory(new DiagramEventBroker.DiagramEventBrokerFactory() { public DiagramEventBroker createDiagramEventBroker(TransactionalEditingDomain editingDomain) { return new DiagramEventBrokerThreadSafe(editingDomain); }//from w w w. j a v a 2 s. c om }); }
From source file:org.eclipse.gmf.runtime.diagram.ui.printing.internal.util.PrintHelperUtil.java
License:Open Source License
/** * Initialize the preferences for a diagram edit part, specifically * including page breaks and margins./*from w w w . j a va2 s .co m*/ * * Typically, the diagram edit part is created using * createDiagramEditPart() and the diagram edit part is passed in as the * first parameter of this method. * * @param diagramEditPart the DiagramEditPart to pass in * @param preferencesHint the preferences hint to use for intiializing the preferences * * @return true if the preferences could be loaded, false if they weren't * loaded and defaults had to be used instead */ public static boolean initializePreferences(DiagramEditPart diagramEditPart, PreferencesHint preferencesHint) { assert diagramEditPart.getViewer() instanceof DiagramGraphicalViewer; DiagramGraphicalViewer viewer = (DiagramGraphicalViewer) diagramEditPart.getViewer(); boolean loadedPreferences = true; IPreferenceStore fPreferences = getPreferenceStoreForDiagram(diagramEditPart); if (fPreferences == null) { loadedPreferences = false; //leave at default x and y PreferenceStore defaults = new PreferenceStore(); DiagramEditor.addDefaultPreferences(defaults, preferencesHint); fPreferences = getWorkspacePreferenceStore(preferencesHint); } else if (!fPreferences.getBoolean(WorkspaceViewerProperties.PREF_USE_DIAGRAM_SETTINGS)) { //if we aren't supposed to use the diagram settings, switch to the //workspace settings //we have to use the page break x and y settings from the diagram int x = fPreferences.getInt(WorkspaceViewerProperties.PAGEBREAK_X), y = fPreferences.getInt(WorkspaceViewerProperties.PAGEBREAK_Y); //minor performance optimization, use the existing //preferences from the workspace instead of making a new one fPreferences = getWorkspacePreferenceStore(preferencesHint); fPreferences.setValue(WorkspaceViewerProperties.PAGEBREAK_X, x); fPreferences.setValue(WorkspaceViewerProperties.PAGEBREAK_Y, y); } viewer.hookWorkspacePreferenceStore(fPreferences); diagramEditPart.refreshPageBreaks(); return loadedPreferences; }
From source file:org.eclipse.jdt.internal.ui.preferences.formatter.JavaPreview.java
License:Open Source License
public JavaPreview(Map<String, String> workingValues, Composite parent) { JavaTextTools tools = JavaPlugin.getDefault().getJavaTextTools(); fPreviewDocument = new Document(); fWorkingValues = workingValues;/* ww w. ja va 2 s . c o m*/ tools.setupJavaDocumentPartitioner(fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING); PreferenceStore prioritizedSettings = new PreferenceStore(); HashMap<String, String> complianceOptions = new HashMap<String, String>(); JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST); for (Entry<String, String> complianceOption : complianceOptions.entrySet()) { prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue()); } IPreferenceStore[] chain = { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() }; fPreferenceStore = new ChainedPreferenceStore(chain); fSourceViewer = new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore); fSourceViewer.setEditable(false); Cursor arrowCursor = fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW); fSourceViewer.getTextWidget().setCursor(arrowCursor); // Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263 // fSourceViewer.getTextWidget().setCaret(null); fViewerConfiguration = new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true); fSourceViewer.configure(fViewerConfiguration); fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fMarginPainter = new MarginPainter(fSourceViewer); final RGB rgb = PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR); fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb)); fSourceViewer.addPainter(fMarginPainter); new JavaSourcePreviewerUpdater(); fSourceViewer.setDocument(fPreviewDocument); }
From source file:org.eclipse.jdt.text.tests.JavaColoringTest.java
License:Open Source License
protected void setUp() { IPreferenceStore store = new PreferenceStore(); fTextTools = new JavaTextTools(store); fTextViewer = new TestTextViewer(); fDocument = new Document(); IDocumentPartitioner partitioner = fTextTools.createDocumentPartitioner(); partitioner.connect(fDocument);//from ww w . j a va 2 s. c om fDocument.setDocumentPartitioner(partitioner); IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore(); IPreferenceStore combinedStore = new ChainedPreferenceStore( new IPreferenceStore[] { store, generalTextStore }); SourceViewerConfiguration conf = new JavaSourceViewerConfiguration(fTextTools.getColorManager(), combinedStore, null, null); IPresentationReconciler reconciler = conf.getPresentationReconciler(fTextViewer); reconciler.install(fTextViewer); System.out.print("------ next ---------\n"); }
From source file:org.eclipse.jdt.text.tests.JavaPartitionerExtensionTest.java
License:Open Source License
protected void setUp() { fTextTools = new JavaTextTools(new PreferenceStore()); fDocument = new Document(); IDocumentPartitioner partitioner = fTextTools.createDocumentPartitioner(); partitioner.connect(fDocument);/*from www. ja va 2 s .c om*/ fDocument.setDocumentPartitioner(partitioner); fDocumentPartitioningChanged = false; fChangedDocumentPartitioning = null; fDocument.addDocumentPartitioningListener(new PartitioningListener()); }