Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Overbey2007-10-03 19:18:20 +0000
committerJeffrey Overbey2007-10-03 19:18:20 +0000
commit1b0028324004b38fba82f11a90af758b293731a4 (patch)
tree0f2751b974ac8eeea37417ab40164e995cec7623
parentaddf4c49dde465bc0f25ac4b9cdd3db6e58a78e1 (diff)
downloadorg.eclipse.photran-1b0028324004b38fba82f11a90af758b293731a4.tar.gz
org.eclipse.photran-1b0028324004b38fba82f11a90af758b293731a4.tar.xz
org.eclipse.photran-1b0028324004b38fba82f11a90af758b293731a4.zip
Added Photran VPG option to project properties
-rw-r--r--org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java4
-rw-r--r--org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/properties/SearchPathProperties.java1
-rw-r--r--org.eclipse.photran.ui.vpg/plugin.xml2
-rw-r--r--org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java48
-rw-r--r--org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/WorkspacePathEditor.java2
5 files changed, 48 insertions, 9 deletions
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java
index 5f3ee431..b25a58d8 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/core/vpg/PhotranVPG.java
@@ -47,6 +47,7 @@ import org.eclipse.photran.internal.core.lexer.LexerFactory;
import org.eclipse.photran.internal.core.lexer.SourceForm;
import org.eclipse.photran.internal.core.lexer.Token;
import org.eclipse.photran.internal.core.parser.Parser;
+import org.eclipse.photran.internal.core.properties.SearchPathProperties;
import bz.over.vpg.TokenRef;
import bz.over.vpg.VPGDependency;
@@ -156,7 +157,8 @@ public class PhotranVPG extends EclipseVPG<IFortranAST, Token>
{
try
{
- return project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID);
+ return (project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID))
+ && (inTestingMode() || SearchPathProperties.getProperty(project, SearchPathProperties.ENABLE_VPG_PROPERTY_NAME).equals("true"));
}
catch (CoreException e)
{
diff --git a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/properties/SearchPathProperties.java b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/properties/SearchPathProperties.java
index 2cb5ed48..e68ad4b5 100644
--- a/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/properties/SearchPathProperties.java
+++ b/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/properties/SearchPathProperties.java
@@ -34,6 +34,7 @@ import org.eclipse.core.runtime.QualifiedName;
*/
public class SearchPathProperties
{
+ public static final String ENABLE_VPG_PROPERTY_NAME = "EnableVPG";
public static final String MODULE_PATHS_PROPERTY_NAME = "FortranModulePaths";
public static final String INCLUDE_PATHS_PROPERTY_NAME = "FortranIncludePaths";
diff --git a/org.eclipse.photran.ui.vpg/plugin.xml b/org.eclipse.photran.ui.vpg/plugin.xml
index 59c264fa..28b8c3e3 100644
--- a/org.eclipse.photran.ui.vpg/plugin.xml
+++ b/org.eclipse.photran.ui.vpg/plugin.xml
@@ -78,7 +78,7 @@
<page
objectClass="org.eclipse.core.resources.IProject"
adaptable="true"
- name="Fortran Refactoring Engine Search Paths"
+ name="Fortran Analysis/Refactoring"
class="org.eclipse.photran.internal.ui.properties.SearchPathsPropertyPage"
id="org.eclipse.photran.ui.SearchPathsPropertyPage">
<!--filter
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java
index f4aaef53..771b2dff 100644
--- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/SearchPathsPropertyPage.java
@@ -11,6 +11,7 @@
package org.eclipse.photran.internal.ui.properties;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.util.IPropertyChangeListener;
@@ -33,6 +34,7 @@ import org.eclipse.ui.dialogs.PropertyPage;
*/
public class SearchPathsPropertyPage extends PropertyPage
{
+ private BooleanFieldEditor enableVPG;
private WorkspacePathEditor modulePathEditor, includePathEditor;
/**
@@ -41,17 +43,47 @@ public class SearchPathsPropertyPage extends PropertyPage
protected Control createContents(Composite parent)
{
Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
+ composite.setLayout(new GridLayout(1, true));
GridData data = new GridData(GridData.FILL);
data.grabExcessHorizontalSpace = true;
composite.setLayoutData(data);
-
+
Label l = new Label(composite, SWT.WRAP);
+ l.setText("To enable Open Declaration and refactoring in Fortran programs, check the following "
+ + "box. A program database (the Virtual Program Graph, or VPG) will be updated as "
+ + "Fortran files are modified. These features are EXPERIMENTAL and have not been "
+ + "optimized to work well on large programs.");
+ l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
+
+ enableVPG = new BooleanFieldEditor("IgnoreThis", "Enable Fortran analysis/refactoring", composite);
+ enableVPG.setPreferenceStore(new CustomPropertyStore()
+ {
+ @Override protected String getProperty()
+ {
+ return SearchPathProperties.getProperty((IProject)getElement(), SearchPathProperties.ENABLE_VPG_PROPERTY_NAME);
+ }
+
+ @Override protected String getDefault()
+ {
+ return SearchPathProperties.getPropertyDefault((IProject)getElement(), SearchPathProperties.ENABLE_VPG_PROPERTY_NAME);
+ }
+
+ @Override protected void setProperty(String value)
+ {
+ SearchPathProperties.setProperty((IProject)getElement(), SearchPathProperties.ENABLE_VPG_PROPERTY_NAME, value);
+ }
+
+ });
+ enableVPG.load();
+
+ l = new Label(composite, SWT.WRAP);
+ l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+
+ l = new Label(composite, SWT.WRAP);
l.setText("The following specify the paths searched when the refactoring engine "
+ "attempts to locate modules and INCLUDE files. These MAY BE DIFFERENT from the "
+ "paths used by your compiler to build your project.");
- l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+ l.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
modulePathEditor = new WorkspacePathEditor((IProject)getElement(),
SearchPathProperties.MODULE_PATHS_PROPERTY_NAME,
@@ -107,12 +139,14 @@ public class SearchPathsPropertyPage extends PropertyPage
protected void performDefaults()
{
+ enableVPG.loadDefault();
modulePathEditor.loadDefault();
includePathEditor.loadDefault();
}
public boolean performOk()
{
+ enableVPG.store();
modulePathEditor.store();
includePathEditor.store();
return true;
@@ -123,7 +157,7 @@ public class SearchPathsPropertyPage extends PropertyPage
public void addPropertyChangeListener(IPropertyChangeListener listener) {;}
public boolean contains(String name) {throw new Error();}
public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {;}
- public boolean getBoolean(String name) {throw new Error();}
+ public boolean getBoolean(String name) { return getProperty().equals("true"); }
public boolean getDefaultBoolean(String name) {throw new Error();}
public double getDefaultDouble(String name) {throw new Error();}
public float getDefaultFloat(String name) {throw new Error();}
@@ -144,14 +178,14 @@ public class SearchPathsPropertyPage extends PropertyPage
public void setDefault(String name, int value) {;}
public void setDefault(String name, long value) {;}
public void setDefault(String name, String defaultObject) {throw new Error();}
- public void setDefault(String name, boolean value) {;}
+ public void setDefault(String name, boolean value) { setProperty(null); }
public void setToDefault(String name) { setProperty(null); } ///////////
public void setValue(String name, double value) {;}
public void setValue(String name, float value) {;}
public void setValue(String name, int value) {;}
public void setValue(String name, long value) {;}
public void setValue(String name, String value) { setProperty(value); } ///////
- public void setValue(String name, boolean value) {;}
+ public void setValue(String name, boolean value) { setProperty(value ? "true" : "false"); }
protected abstract String getProperty();
protected abstract String getDefault();
diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/WorkspacePathEditor.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/WorkspacePathEditor.java
index b5200497..4c8956d9 100644
--- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/WorkspacePathEditor.java
+++ b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/properties/WorkspacePathEditor.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.ListEditor;
import org.eclipse.photran.internal.core.properties.SearchPathProperties;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.dialogs.ContainerSelectionDialog;
@@ -54,6 +55,7 @@ public class WorkspacePathEditor extends ListEditor
*/
public WorkspacePathEditor(IProject project, String name, String labelText, String dirChooserLabelText, Composite parent)
{
+ parent = new Composite(parent, SWT.NONE);
init(name, labelText);
this.project = project;
this.dirChooserLabelText = dirChooserLabelText;

Back to the top