Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2005 John-Mason P. Shackelford and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: John-Mason P. Shackelford - initial API and implementation IBM Corporation - bug fixes /
 
 package org.eclipse.ant.internal.ui.editor.templates;
 
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.graphics.Font;
 import  org.eclipse.swt.widgets.Composite;

See also:
org.eclipse.jface.preference.PreferencePage
 
 
 	
     public AntTemplatePreferencePage() {
         setPreferenceStore(AntUIPlugin.getDefault().getPreferenceStore());
         setTemplateStore(AntTemplateAccess.getDefault().getTemplateStore());
         setContextTypeRegistry(AntTemplateAccess.getDefault().getContextTypeRegistry());
     }
 
     /* (non-Javadoc)
      * @see org.eclipse.jface.preference.IPreferencePage#performOk()
      */
     public boolean performOk() {
     	  boolean ok = super.performOk();
     	  AntUIPlugin.getDefault().savePluginPreferences();
     	  return ok;
     }
 
     /*
      * (non-Javadoc)
      * 
      * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#createViewer(org.eclipse.swt.widgets.Composite)
      */
     protected SourceViewer createViewer(Composite parent) {
     	SourceViewer viewer = new SourceViewer(parentnull, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
           
 		SourceViewerConfiguration configuration = new AntTemplateViewerConfiguration();        
 		IDocument document = new Document();       
 		viewer.configure(configuration);
 		viewer.setDocument(document);
 		viewer.setEditable(false);	
 		Font font= JFaceResources.getFont(.);
 		viewer.getTextWidget().setFont(font);    
 		        
 		return viewer;
     }
 
     /* (non-Javadoc)
      * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#getFormatterPreferenceKey()
      */
     protected String getFormatterPreferenceKey() {
 	}
 	
 	/*
 	 * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#updateViewerInput()
 	 */
 	protected void updateViewerInput() {
 		SourceViewer viewergetViewer();
 		
 		if (selection.size() == 1 && selection.getFirstElement() instanceof TemplatePersistenceData) {
 			Template templatedata.getTemplate();
 				String formatted= XmlFormatter.format(template.getPattern(), );
 				viewer.getDocument().set(formatted);
 			} else {
 				viewer.getDocument().set(template.getPattern());
 			}
 		} else {
 			viewer.getDocument().set(""); //$NON-NLS-1$
 		}		
	}
	/* (non-Javadoc)
	 * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#isShowFormatterSetting()
	 */
	protected boolean isShowFormatterSetting() {
		return false;
	}
New to GrepCode? Check out our FAQ X