1 11 package org.eclipse.jdt.internal.ui.preferences; 12 13 import org.eclipse.core.resources.IProject; 14 import org.eclipse.core.resources.IResource; 15 import org.eclipse.core.runtime.IAdaptable; 16 17 import org.eclipse.swt.SWT; 18 import org.eclipse.swt.SWTException; 19 import org.eclipse.swt.widgets.Composite; 20 import org.eclipse.swt.widgets.Control; 21 22 import org.eclipse.jface.dialogs.Dialog; 23 import org.eclipse.jface.preference.IPreferencePageContainer; 24 import org.eclipse.jface.preference.PreferenceDialog; 25 26 import org.eclipse.ui.dialogs.PropertyPage; 27 import org.eclipse.ui.forms.events.HyperlinkAdapter; 28 import org.eclipse.ui.forms.events.HyperlinkEvent; 29 import org.eclipse.ui.forms.widgets.FormText; 30 import org.eclipse.ui.forms.widgets.FormToolkit; 31 import org.eclipse.ui.forms.widgets.TableWrapData; 32 import org.eclipse.ui.forms.widgets.TableWrapLayout; 33 34 import org.eclipse.jdt.internal.corext.util.Messages; 35 36 39 public class JavaCategoryPropertyPage extends PropertyPage { 40 41 private IProject fProject; 42 43 private final static String HREF_BUILDPATH= BuildPathsPropertyPage.PROP_ID; 44 private final static String HREF_COMPILER= CompliancePreferencePage.PROP_ID; 45 private final static String HREF_CODESTYLE= CodeStylePreferencePage.PROP_ID; 46 private final static String HREF_JLOC= JavadocConfigurationPropertyPage.PROP_ID; 47 private final static String HREF_TODO= TodoTaskPreferencePage.PROP_ID; 48 private final static String HREF_PSEVERITIES= ProblemSeveritiesPreferencePage.PROP_ID; 49 private final static String HREF_JAVADOC= JavadocProblemsPreferencePage.PROP_ID; 50 private final static String HREF_FORMATTER= CodeFormatterPreferencePage.PROP_ID; 51 private final static String HREF_TEMPLATES= ""; private final static String HREF_IMPORTORDER= ImportOrganizePreferencePage.PROP_ID; 53 private final static String HREF_BUILDING= JavaBuildPreferencePage.PROP_ID; 54 55 58 protected Control createContents(Composite parent) { 59 Composite composite= new Composite(parent, SWT.NONE); 60 composite.setLayout(new TableWrapLayout()); 61 62 FormToolkit toolkit= new FormToolkit(parent.getDisplay()); 63 try { 64 String [] args= { 65 fProject.getName(), HREF_BUILDPATH, HREF_COMPILER, HREF_TODO, HREF_PSEVERITIES, HREF_JAVADOC, HREF_BUILDING, 66 HREF_CODESTYLE, HREF_FORMATTER, HREF_TEMPLATES, HREF_IMPORTORDER, HREF_JLOC 67 }; 68 String msg= Messages.format(PreferencesMessages.JavaCategoryPropertyPage_text, args); 69 70 FormText formText = toolkit.createFormText(composite, true); 71 try { 72 formText.setText(msg, true, false); 73 } catch (SWTException e) { 74 formText.setText(e.getMessage(), false, false); 75 } 76 77 formText.setBackground(null); 78 formText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); 79 formText.addHyperlinkListener(new HyperlinkAdapter() { 80 public void linkActivated(HyperlinkEvent e) { 81 doLinkActivated(e.data.toString()); 82 } 83 }); 84 } finally { 85 toolkit.dispose(); 86 } 87 88 Dialog.applyDialogFont(composite); 89 return composite; 90 } 91 92 protected void doLinkActivated(String string) { 93 if (string.length() > 0) { 94 IPreferencePageContainer container= getContainer(); 95 if (container instanceof PreferenceDialog) { 96 } 98 } 99 } 100 101 102 103 106 public IAdaptable getElement() { 107 return fProject; 108 } 109 110 113 public void setElement(IAdaptable element) { 114 fProject= (IProject) element.getAdapter(IResource.class); 115 } 116 117 } 118 | Popular Tags |