### Eclipse Workspace Patch 1.0
#P org.eclipse.photran.ui
Index: plugin.xml
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.ui/plugin.xml,v
retrieving revision 1.24
diff -u -r1.24 plugin.xml
--- plugin.xml 13 Nov 2009 16:59:42 -0000 1.24
+++ plugin.xml 3 May 2010 17:52:51 -0000
@@ -227,6 +227,12 @@
class="org.eclipse.photran.internal.ui.preferences.CDTFortranPreferencePage"
id="org.eclipse.photran.ui.CDTFortranPreferencePage">
+
+
Index: src/org/eclipse/photran/internal/ui/preferences/CppFileTypesPreferencePage.java
===================================================================
RCS file: src/org/eclipse/photran/internal/ui/preferences/CppFileTypesPreferencePage.java
diff -N src/org/eclipse/photran/internal/ui/preferences/CppFileTypesPreferencePage.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/photran/internal/ui/preferences/CppFileTypesPreferencePage.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2010 University of Illinois at Urbana-Champaign 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:
+ * UIUC - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.photran.internal.ui.preferences;
+
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.photran.internal.core.preferences.FortranPreferences;
+
+/**
+ *
+ * @author Kurt Hendle
+ */
+public class CppFileTypesPreferencePage extends AbstractFortranPreferencePage
+{
+ protected void setDescrption()
+ {
+ }
+
+ protected void initializeDefaults()
+ {
+ FortranPreferences.CPP_FIXED_FORM_TYPES.setDefault();
+ FortranPreferences.CPP_FREE_FORM_TYPES.setDefault();
+ }
+
+ protected void createFieldEditors()
+ {
+ addField(new StringFieldEditor(FortranPreferences.CPP_FIXED_FORM_TYPES.getName(),
+ "Fixed Form file types",
+ getFieldEditorParent()));
+
+ addField(new StringFieldEditor(FortranPreferences.CPP_FREE_FORM_TYPES.getName(),
+ "Free Form file types",
+ getFieldEditorParent()));
+ }
+
+}
#P org.eclipse.photran.ui.vpg
Index: src/org/eclipse/photran/internal/ui/properties/CPPFileTypeEditor.java
===================================================================
RCS file: src/org/eclipse/photran/internal/ui/properties/CPPFileTypeEditor.java
diff -N src/org/eclipse/photran/internal/ui/properties/CPPFileTypeEditor.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/photran/internal/ui/properties/CPPFileTypeEditor.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.photran.internal.ui.properties;
+
+import java.util.Arrays;
+
+import org.eclipse.jface.preference.ListEditor;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.photran.internal.core.properties.SearchPathProperties;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.ListDialog;
+
+/**
+ * A field editor to edit which file types to send to the C Preprocessor.
+ *
+ * @author Jeff Overbey, Kurt Hendle
+ */
+public class CPPFileTypeEditor extends ListEditor
+{
+ private String[] fileTypes;
+ /**
+ * The special label text for chooser,
+ * or null
if none.
+ */
+ private String fileTypeInputLabelText;
+
+ /**
+ * Creates a new path field editor
+ */
+ protected CPPFileTypeEditor()
+ {
+ }
+
+ /**
+ * Creates a CPP file type chooser.
+ *
+ * @param name the name of the preference this field editor works on
+ * @param labelText the label text of the field editor
+ * @param fileTypes an array of file types to be available in the list
+ * @param typeChooserText the label text displayed for the directory chooser
+ * @param parent the parent of the field editor's control
+ */
+ public CPPFileTypeEditor(String name, String labelText, String[] fileTypes, String typeChooserText, Composite parent)
+ {
+ parent = new Composite(parent, SWT.NONE);
+ init(name, labelText);
+ this.fileTypes = fileTypes;
+ this.fileTypeInputLabelText = typeChooserText;
+ createControl(parent);
+ }
+
+ /* (non-Javadoc)
+ * Method declared on ListEditor.
+ * Creates a new path element by means of a directory dialog.
+ */
+ protected String getNewInputObject()
+ {
+ //set up the list dialog box
+ ListDialog dialog = new ListDialog(getShell());
+ dialog.setInput(fileTypes);
+ dialog.setContentProvider(new ArrayContentProvider());
+ dialog.setLabelProvider(new LabelProvider());
+ dialog.setMessage(fileTypeInputLabelText);
+
+ if (dialog.open() == ListDialog.OK)
+ {
+ //result is returned as an object array, must convert it to string and return string
+ Object[] selection = dialog.getResult();
+ String [] type = Arrays.asList(selection).toArray(new String[selection.length]);
+ return type[0];
+ }
+
+ return null;
+ }
+
+ @Override
+ protected String createList(String[] items)
+ {
+ return SearchPathProperties.createList(items);
+ }
+
+ @Override
+ protected String[] parseString(String stringList)
+ {
+ return SearchPathProperties.parseString(stringList);
+ }
+}
Index: src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java,v
retrieving revision 1.9
diff -u -r1.9 SearchPathsPropertyPage.java
--- src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java 3 Nov 2009 16:29:50 -0000 1.9
+++ src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java 3 May 2010 17:52:51 -0000
@@ -106,6 +106,7 @@
private FortranBooleanFieldEditor enableVPG, enableDeclView, enableContentAssist, enableHoverTip;
private WorkspacePathEditor modulePathEditor, includePathEditor;
+ private CPPFileTypeEditor fixedFormEditor, freeFormEditor;
/**
* @see PreferencePage#createContents(Composite)
@@ -208,6 +209,31 @@
includePathEditor.setPreferenceStore(scopedStore);
includePathEditor.load();
+ l = new Label(composite, SWT.WRAP);
+ l.setText("The following specify the types of fixed form and free form\n" +
+ "Fortran files you wish to be processed by the C preprocessor.");
+ l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ fixedFormEditor = new CPPFileTypeEditor(SearchPathProperties.FIXED_FORM_CPP_TYPES_PROPERTY_NAME,
+ "Fixed form file types to be C preprocessed",
+ new String[] { "F77","fpp","F","FOR","FTN","FIX","FPP" },
+ "Please choose a fixed form file type",
+ parent);
+
+ fixedFormEditor.setPreferenceStore(scopedStore);
+ fixedFormEditor.load();
+
+ freeFormEditor = new CPPFileTypeEditor(SearchPathProperties.FREE_FORM_CPP_TYPES_PROPERTY_NAME,
+ "Free form file types to be C preprocessed",
+ new String[] { "F90","F95","F03","F08" },
+ "Please choose a free form file type",
+ parent);
+
+ freeFormEditor.setPreferenceStore(scopedStore);
+ freeFormEditor.load();
+
+
+
return composite;
}