private void createSignaturePreview(Composite composite) { Label previewLabel= new Label(composite, SWT.NONE); previewLabel.setText(RefactoringMessages.IntroduceParameterObjectWizard_signaturepreview_label); GridData gridData= new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan= 2; previewLabel.setLayoutData(gridData); fSignaturePreview= InputPageUtil.createSignaturePreview(composite); ((GridData) fSignaturePreview.getControl().getLayoutData()).horizontalSpan= 2; updateSignaturePreview(); }
private void createSignaturePreview(Composite composite) { Label previewLabel= new Label(composite, SWT.NONE); previewLabel.setText(RefactoringMessages.IntroduceParameterObjectWizard_signaturepreview_label); GridData gridData= new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan= 2; previewLabel.setLayoutData(gridData); fSignaturePreview= InputPageUtil.createSignaturePreview(composite); ((GridData) fSignaturePreview.getControl().getLayoutData()).horizontalSpan= 2; updateSignaturePreview(); }
private void createSignaturePreview(Composite composite, RowLayouter layouter) { Label previewLabel= new Label(composite, SWT.NONE); previewLabel.setText(RefactoringMessages.ExtractMethodInputPage_signature_preview); layouter.perform(previewLabel); fSignaturePreview= InputPageUtil.createSignaturePreview(composite); layouter.perform(fSignaturePreview.getControl()); }
private void createSignaturePreview(Composite composite, RowLayouter layouter) { Label previewLabel= new Label(composite, SWT.NONE); previewLabel.setText(RefactoringMessages.ExtractMethodInputPage_signature_preview); layouter.perform(previewLabel); fSignaturePreview= InputPageUtil.createSignaturePreview(composite); layouter.perform(fSignaturePreview.getControl()); }
private void createSignaturePreview(Composite composite) { Label previewLabel= new Label(composite, SWT.NONE); previewLabel.setText(RefactoringMessages.ChangeSignatureInputPage_method_Signature_Preview); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); fSignaturePreview= new JavaSourceViewer(composite, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP /*| SWT.BORDER*/, store); fSignaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null)); fSignaturePreview.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fSignaturePreview.getTextWidget().setBackground(composite.getBackground()); fSignaturePreview.setDocument(fSignaturePreviewDocument); fSignaturePreview.setEditable(false); //Layouting problems with wrapped text: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=9866 Control signaturePreviewControl= fSignaturePreview.getControl(); PixelConverter pixelConverter= new PixelConverter(signaturePreviewControl); GridData gdata= new GridData(GridData.FILL_BOTH); gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50); gdata.heightHint= pixelConverter.convertHeightInCharsToPixels(2); signaturePreviewControl.setLayoutData(gdata); }
Control signaturePreviewControl= fSignaturePreview.getControl(); PixelConverter pixelConverter= new PixelConverter(signaturePreviewControl); GridData gdata= new GridData(GridData.FILL_BOTH);
private void createSignaturePreview(Composite composite, RowLayouter layouter) { Label previewLabel= new Label(composite, SWT.NONE); previewLabel.setText(RefactoringMessages.ExtractMethodInputPage_signature_preview); layouter.perform(previewLabel); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); fSignaturePreview= new JavaSourceViewer(composite, null, null, false, SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP /*| SWT.BORDER*/, store); fSignaturePreview.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null)); fSignaturePreview.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); fSignaturePreview.getTextWidget().setBackground(composite.getBackground()); fSignaturePreview.setDocument(fSignaturePreviewDocument); fSignaturePreview.setEditable(false); //Layouting problems with wrapped text: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=9866 Control signaturePreviewControl= fSignaturePreview.getControl(); PixelConverter pixelConverter= new PixelConverter(signaturePreviewControl); GridData gdata= new GridData(GridData.FILL_BOTH); gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50); gdata.heightHint= pixelConverter.convertHeightInCharsToPixels(2); signaturePreviewControl.setLayoutData(gdata); layouter.perform(signaturePreviewControl); }
Control signaturePreviewControl= fSignaturePreview.getControl(); PixelConverter pixelConverter= new PixelConverter(signaturePreviewControl); GridData gdata= new GridData(GridData.FILL_BOTH);
@Override protected SourceViewer createPatternViewer(Composite parent) { IDocument document= new Document(); JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools(); tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); JavaSourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store); SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false); viewer.configure(configuration); viewer.setEditable(false); viewer.setDocument(document); Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new JavaSourcePreviewerUpdater(viewer, configuration, store); Control control= viewer.getControl(); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); control.setLayoutData(data); viewer.setEditable(false); return viewer; }
@Override protected SourceViewer createPatternViewer(Composite parent) { IDocument document= new Document(); JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools(); tools.setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING); IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); JavaSourceViewer viewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL, store); SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), store, null, IJavaPartitions.JAVA_PARTITIONING, false); viewer.configure(configuration); viewer.setEditable(false); viewer.setDocument(document); Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); new JavaSourcePreviewerUpdater(viewer, configuration, store); Control control= viewer.getControl(); GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL); control.setLayoutData(data); viewer.setEditable(false); return viewer; }
private void createMethodSignature(Composite parent) { IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); JavaSourceViewer signatureViewer= new JavaSourceViewer(parent, null, null, false, SWT.READ_ONLY | SWT.WRAP /*| SWT.BORDER*/, store); signatureViewer.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null)); signatureViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); signatureViewer.getTextWidget().setBackground(parent.getBackground()); String signatureLabel= JavaElementLabels.getElementLabel(fRefactoring.getMethod(), LABEL_FLAGS); signatureViewer.setDocument(new Document(signatureLabel)); signatureViewer.setEditable(false); Control signatureControl= signatureViewer.getControl(); PixelConverter pixelConverter= new PixelConverter(signatureControl); GridData gdata= new GridData(GridData.FILL_HORIZONTAL); gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50); signatureControl.setLayoutData(gdata); }
bodyEditor.setEditable(true); Control bodyControl= bodyEditor.getControl(); PixelConverter pixelConverter= new PixelConverter(bodyControl); GridData gdata= new GridData(GridData.FILL_BOTH);
private void createBody(Composite parent) { IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); JavaSourceViewer bodyEditor= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.WRAP | SWT.BORDER, store); bodyEditor.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null)); bodyEditor.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); Document bodyDocument= new Document(getInitialBody()); bodyEditor.setDocument(bodyDocument); bodyEditor.setEditable(true); Control bodyControl= bodyEditor.getControl(); PixelConverter pixelConverter= new PixelConverter(bodyControl); GridData gdata= new GridData(GridData.FILL_BOTH); gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50); gdata.minimumHeight= pixelConverter.convertHeightInCharsToPixels(5); bodyControl.setLayoutData(gdata); bodyControl.setFocus(); bodyDocument.addDocumentListener(new IDocumentListener() { @Override public void documentAboutToBeChanged(DocumentEvent event) { } @Override public void documentChanged(DocumentEvent event) { try { fRefactoring.setBody(event.getDocument().get(), fRefactoring.getMethod().getParameterNames()); } catch (JavaModelException ex) { // TODO Auto-generated catch block JavaPlugin.log(ex); } } }); }
private void createBody(Composite parent) { IPreferenceStore store= JavaPlugin.getDefault().getCombinedPreferenceStore(); JavaSourceViewer bodyEditor= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.WRAP | SWT.BORDER, store); bodyEditor.configure(new JavaSourceViewerConfiguration(JavaPlugin.getDefault().getJavaTextTools().getColorManager(), store, null, null)); bodyEditor.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT)); Document bodyDocument= new Document(getInitialBody()); bodyEditor.setDocument(bodyDocument); bodyEditor.setEditable(true); Control bodyControl= bodyEditor.getControl(); PixelConverter pixelConverter= new PixelConverter(bodyControl); GridData gdata= new GridData(GridData.FILL_BOTH); gdata.widthHint= pixelConverter.convertWidthInCharsToPixels(50); gdata.minimumHeight= pixelConverter.convertHeightInCharsToPixels(5); bodyControl.setLayoutData(gdata); bodyControl.setFocus(); bodyDocument.addDocumentListener(new IDocumentListener() { @Override public void documentAboutToBeChanged(DocumentEvent event) { } @Override public void documentChanged(DocumentEvent event) { try { fRefactoring.setBody(event.getDocument().get(), fRefactoring.getMethod().getParameterNames()); } catch (JavaModelException ex) { // TODO Auto-generated catch block JavaPlugin.log(ex); } } }); }
private Control createPreviewer(Composite parent) { IPreferenceStore generalTextStore= EditorsUI.getPreferenceStore(); IPreferenceStore store= new ChainedPreferenceStore(new IPreferenceStore[] { getPreferenceStore(), new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore }); fPreviewViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store); SimpleJavaSourceViewerConfiguration configuration= new SimpleJavaSourceViewerConfiguration(fColorManager, store, null, IJavaPartitions.JAVA_PARTITIONING, false); fPreviewViewer.configure(configuration); // fake 1.5 source to get 1.5 features right. configuration.handlePropertyChangeEvent(new PropertyChangeEvent(this, JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_4, JavaCore.VERSION_1_5)); Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); fPreviewViewer.getTextWidget().setFont(font); new JavaSourcePreviewerUpdater(fPreviewViewer, configuration, store); fPreviewViewer.setEditable(false); String content= loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$ IDocument document= new Document(content); JavaPlugin.getDefault().getJavaTextTools().setupJavaDocumentPartitioner(document, IJavaPartitions.JAVA_PARTITIONING); fPreviewViewer.setDocument(document); installSemanticHighlighting(); return fPreviewViewer.getControl(); }
return fPreviewViewer.getControl();
return fPreviewViewer.getControl();