Several bugfixes for 4.0 beta 3
diff --git a/org.eclipse.photran-feature/feature.xml b/org.eclipse.photran-feature/feature.xml
index 8e99b81..b5848f2 100644
--- a/org.eclipse.photran-feature/feature.xml
+++ b/org.eclipse.photran-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.photran_feature"
label="Photran"
- version="4.0.2"
+ version="4.0.3"
provider-name="University of Illinois at Urbana-Champaign and Los Alamos National Laboratory"
os="linux,macosx,solaris,win32"
nl="en_US">
@@ -153,58 +153,58 @@
id="org.eclipse.photran.core"
download-size="0"
install-size="0"
- version="4.0.2"/>
+ version="4.0.3"/>
<plugin
id="org.eclipse.photran.managedbuilder.core"
download-size="0"
install-size="0"
- version="4.0.2"
+ version="4.0.3"
unpack="false"/>
<plugin
id="org.eclipse.photran.managedbuilder.ui"
download-size="0"
install-size="0"
- version="4.0.2"/>
+ version="4.0.3"/>
<plugin
id="org.eclipse.photran.cdtinterface"
download-size="0"
install-size="0"
- version="4.0.2"/>
+ version="4.0.3"/>
<plugin
id="org.eclipse.photran.ui"
download-size="0"
install-size="0"
- version="4.0.2"/>
+ version="4.0.3"/>
<plugin
id="org.eclipse.photran.errorparsers.xlf"
download-size="0"
install-size="0"
- version="4.0.2"
+ version="4.0.3"
unpack="false"/>
<plugin
id="org.eclipse.photran.managedbuilder.gnu.ui"
download-size="0"
install-size="0"
- version="4.0.2"
+ version="4.0.3"
unpack="false"/>
<plugin
id="org.eclipse.photran.managedbuilder.intel.ui"
download-size="0"
install-size="0"
- version="4.0.2"/>
+ version="4.0.3"/>
<plugin
id="org.eclipse.photran.managedbuilder.xlf.ui"
download-size="0"
install-size="0"
- version="4.0.2"
+ version="4.0.3"
unpack="false"/>
</feature>
diff --git a/org.eclipse.photran.cdtinterface/META-INF/MANIFEST.MF b/org.eclipse.photran.cdtinterface/META-INF/MANIFEST.MF
index 8befcc6..ef11251 100644
--- a/org.eclipse.photran.cdtinterface/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.cdtinterface/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Photran CDT Interface Plug-in
Bundle-SymbolicName: org.eclipse.photran.cdtinterface; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-ClassPath: cdtinterface.jar
Bundle-Activator: org.eclipse.photran.cdtinterface.CDTInterfacePlugin
Bundle-Vendor: University of Illinois at Urbana-Champaign and Los Alamos National Laboratory
diff --git a/org.eclipse.photran.cdtinterface/plugin.xml b/org.eclipse.photran.cdtinterface/plugin.xml
index 7672f3b..512ef05 100644
--- a/org.eclipse.photran.cdtinterface/plugin.xml
+++ b/org.eclipse.photran.cdtinterface/plugin.xml
@@ -34,8 +34,6 @@
<perspectiveExtension targetID="org.eclipse.photran.ui.FortranPerspective">
<perspectiveShortcut id="org.eclipse.debug.ui.DebugPerspective"/>
<perspectiveShortcut id="org.eclipse.team.ui.TeamSynchronizingPerspective"/>
- <actionSet id="org.eclipse.debug.ui.launchActionSet"/>
- <actionSet id="org.eclipse.cdt.managedbuilder.ui.buildConfigActionSet"/>
<view
id="org.eclipse.cdt.make.ui.views.MakeView"
relationship="stack"
@@ -43,6 +41,18 @@
visible="true"/>
<viewShortcut id="org.eclipse.cdt.make.ui.views.MakeView"/>
<actionSet id="org.eclipse.cdt.make.ui.makeTargetActionSet"/>
+
+ <!-- Copied from CDT UI for CDT 4.0 -->
+ <actionSet id="org.eclipse.debug.ui.launchActionSet"/>
+ <actionSet id="org.eclipse.cdt.ui.buildConfigActionSet"/>
+ <actionSet id="org.eclipse.cdt.ui.NavigationActionSet"/>
+ <actionSet id="org.eclipse.cdt.ui.OpenActionSet"/>
+ <actionSet id="org.eclipse.ui.edit.text.actionSet.presentation"/>
+ <!--showInPart id="org.eclipse.cdt.ui.includeBrowser"/-->
+ <!--showInPart id="org.eclipse.cdt.ui.CView"/-->
+ <!--showInPart id="org.eclipse.ui.navigator.ProjectExplorer"/-->
+ <viewShortcut id="org.eclipse.ui.navigator.ProjectExplorer"/>
+ <viewShortcut id="org.eclipse.cdt.ui.includeBrowser"/>
</perspectiveExtension>
</extension>
diff --git a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/cdtinterface/ui/FortranWizardRegistry.java b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/cdtinterface/ui/FortranWizardRegistry.java
index ee9c81f..eeb97c1 100644
--- a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/cdtinterface/ui/FortranWizardRegistry.java
+++ b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/cdtinterface/ui/FortranWizardRegistry.java
@@ -10,15 +10,7 @@
*******************************************************************************/
package org.eclipse.photran.cdtinterface.ui;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.cdt.internal.ui.wizards.OpenNewWizardAction;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.cdt.internal.ui.wizards.CWizardRegistry;
/**
* Convenience class for drop-in Fortran Wizard contributions.
@@ -27,357 +19,357 @@
*
* @author C.E.Rasmussen
*/
-public class FortranWizardRegistry {
-
- public final static String FORTRAN_WIZARD_CATEGORY_ID = "org.eclipse.photran.ui.newFortranWizards"; //$NON-NLS-1$
-
- private final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$
- private final static String ATT_CATEGORY = "category";//$NON-NLS-1$
- private final static String ATT_PROJECT = "project";//$NON-NLS-1$
- private final static String TAG_PARAMETER = "parameter";//$NON-NLS-1$
- private final static String TAG_NAME = "name";//$NON-NLS-1$
- private final static String TAG_VALUE = "value";//$NON-NLS-1$
- private final static String ATT_FORTRAN_TYPE = "ctype";//$NON-NLS-1$
- private final static String ATT_FORTRAN_FILE = "cfile";//$NON-NLS-1$
- private final static String ATT_FORTRAN_FOLDER = "cfolder";//$NON-NLS-1$
- private final static String ATT_FORTRAN_PROJECT = "cproject";//$NON-NLS-1$
- private final static String TAG_CLASS = "class"; //$NON-NLS-1$
- private final static String TAG_ID = "id"; //$NON-NLS-1$
- private final static String PL_NEW = "newWizards"; //$NON-NLS-1$
-
- /**
- * Checks if wizard supports Fortran projects.
- *
- * @param element the wizard element
- *
- * @return <code>true</code> if the given wizard element applies to a C Project
- */
- public static boolean isFortranProjectWizard(IConfigurationElement element) {
- String category = element.getAttribute(ATT_CATEGORY);
- return (category != null && category.equals(FORTRAN_WIZARD_CATEGORY_ID));
- }
-
- /**
- * Returns IDs of all Fortran project wizards contributed to the workbench.
- *
- * @return an array of wizard ids
- */
- public static String[] getProjectWizardIDs() {
- return getWizardIDs(getProjectWizardElements());
- }
-
- /**
- * Returns extension data for all the Fortran project wizards contributed to the workbench.
- * <wizard
- * name="My C Wizard"
- * icon="icons/cwiz.gif"
- * category="org.eclipse.cdt.ui.newCWizards"
- * id="xx.MyCWizard"
- * class="org.xx.MyCWizard"
- * project="true">
- * <description>
- * My C Wizard
- * </description>
- * </wizard>
- *
- *
- * @return an array of IConfigurationElement
- */
- public static IConfigurationElement[] getProjectWizardElements() {
- List elemList = new ArrayList();
- IConfigurationElement[] elements = getAllWizardElements();
- for (int i = 0; i < elements.length; ++i) {
- IConfigurationElement element = elements[i];
- if (isProjectWizard(element)) {
- elemList.add(element);
- }
- }
- return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
- }
-
- private static boolean isProjectWizard(IConfigurationElement element) {
- String project = element.getAttribute(ATT_PROJECT);
- if (project != null) {
- return Boolean.valueOf(project).booleanValue();
- }
-
- IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
- if (classElements.length > 0) {
- for (int i = 0; i < classElements.length; i++) {
- IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
- for (int k = 0; k < paramElements.length; k++) {
- IConfigurationElement curr = paramElements[k];
- String name = curr.getAttribute(TAG_NAME);
- if (name != null && (name.equals(ATT_FORTRAN_PROJECT))) {
- String value = curr.getAttribute(TAG_VALUE);
- if (value != null)
- return Boolean.valueOf(value).booleanValue();
- }
- }
- }
- return false;
- }
- // fall back, if no <class> element found then assume it's a project wizard
- return true;
- }
-
- public static IAction[] getProjectWizardActions() {
- return createActions(getProjectWizardElements());
- }
-
- /**
- * Returns IDs of all Fortran type wizards contributed to the workbench.
- *
- * @return an array of wizard ids
- */
- public static String[] getTypeWizardIDs() {
- return getWizardIDs(getTypeWizardElements());
- }
-
- /**
- * Returns extension data for all the Fortran type wizards contributed to the workbench.
- * <wizard
- * name="My C Wizard"
- * icon="icons/cwiz.gif"
- * category="org.eclipse.cdt.ui.newCWizards"
- * id="xx.MyCWizard">
- * <class class="org.xx.MyCWizard">
- * <parameter name="ctype" value="true" />
- * </class>
- * <description>
- * My C Wizard
- * </description>
- * </wizard>
- *
- * @return an array of IConfigurationElement
- */
- public static IConfigurationElement[] getTypeWizardElements() {
- List elemList = new ArrayList();
- IConfigurationElement[] elements = getAllWizardElements();
- for (int i = 0; i < elements.length; ++i) {
- IConfigurationElement element = elements[i];
- if (isTypeWizard(element)) {
- elemList.add(element);
- }
- }
- return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
- }
-
- private static boolean isTypeWizard(IConfigurationElement element) {
- IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
- if (classElements.length > 0) {
- for (int i = 0; i < classElements.length; i++) {
- IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
- for (int k = 0; k < paramElements.length; k++) {
- IConfigurationElement curr = paramElements[k];
- String name = curr.getAttribute(TAG_NAME);
- if (name != null && name.equals(ATT_FORTRAN_TYPE)) {
- String value = curr.getAttribute(TAG_VALUE);
- if (value != null)
- return Boolean.valueOf(value).booleanValue();
- }
- }
- }
- }
- return false;
- }
-
- public static IAction[] getTypeWizardActions() {
- return createActions(getTypeWizardElements());
- }
-
- /**
- * Returns IDs of all Fortran file wizards contributed to the workbench.
- *
- * @return an array of wizard ids
- */
- public static String[] getFileWizardIDs() {
- return getWizardIDs(getFileWizardElements());
- }
-
- /**
- * Returns extension data for all the Fortan file wizards contributed to the workbench.
- * <wizard
- * name="My C File Wizard"
- * icon="icons/cwiz.gif"
- * category="org.eclipse.cdt.ui.newCWizards"
- * id="xx.MyCWizard">
- * <class class="org.xx.MyCFileWizard">
- * <parameter name="cfile" value="true" />
- * </class>
- * <description>
- * My C File Wizard
- * </description>
- * </wizard>
- *
- * @return an array of IConfigurationElement
- */
- public static IConfigurationElement[] getFileWizardElements() {
- List elemList = new ArrayList();
- IConfigurationElement[] elements = getAllWizardElements();
- for (int i = 0; i < elements.length; ++i) {
- IConfigurationElement element = elements[i];
- if (isFileWizard(element)) {
- elemList.add(element);
- }
- }
- return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
- }
-
- private static boolean isFileWizard(IConfigurationElement element) {
- IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
- if (classElements.length > 0) {
- for (int i = 0; i < classElements.length; i++) {
- IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
- for (int k = 0; k < paramElements.length; k++) {
- IConfigurationElement curr = paramElements[k];
- String name = curr.getAttribute(TAG_NAME);
- if (name != null && name.equals(ATT_FORTRAN_FILE)) {
- String value = curr.getAttribute(TAG_VALUE);
- if (value != null)
- return Boolean.valueOf(value).booleanValue();
- }
- }
- }
- }
- return false;
- }
-
- public static IAction[] getFolderWizardActions() {
- return createActions(getFolderWizardElements());
- }
-
- /**
- * Returns IDs of all Fortran folder wizards contributed to the workbench.
- *
- * @return an array of wizard ids
- */
- public static String[] getFolderWizardIDs() {
- return getWizardIDs(getFolderWizardElements());
- }
-
- /**
- * Returns extension data for all the Fortran folder wizards contributed to the workbench.
- * <wizard
- * name="My C Folder Wizard"
- * icon="icons/cwiz.gif"
- * category="org.eclipse.cdt.ui.newCWizards"
- * id="xx.MyCWizard">
- * <class class="org.xx.MyCFolderWizard">
- * <parameter name="cfolder" value="true" />
- * </class>
- * <description>
- * My C Folder Wizard
- * </description>
- * </wizard>
- *
- * @return an array of IConfigurationElement
- */
- public static IConfigurationElement[] getFolderWizardElements() {
- List elemList = new ArrayList();
- IConfigurationElement[] elements = getAllWizardElements();
- for (int i = 0; i < elements.length; ++i) {
- IConfigurationElement element = elements[i];
- if (isFolderWizard(element)) {
- elemList.add(element);
- }
- }
- return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
- }
-
- private static boolean isFolderWizard(IConfigurationElement element) {
- IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
- if (classElements.length > 0) {
- for (int i = 0; i < classElements.length; i++) {
- IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
- for (int k = 0; k < paramElements.length; k++) {
- IConfigurationElement curr = paramElements[k];
- String name = curr.getAttribute(TAG_NAME);
- if (name != null && name.equals(ATT_FORTRAN_FOLDER)) {
- String value = curr.getAttribute(TAG_VALUE);
- if (value != null)
- return Boolean.valueOf(value).booleanValue();
- }
- }
- }
- }
- return false;
- }
-
- public static IAction[] getFileWizardActions() {
- return createActions(getFileWizardElements());
- }
-
- private static String[] getWizardIDs(IConfigurationElement[] elements) {
- List idList = new ArrayList();
-
- // add Fortran wizards first
- for (int i = 0; i < elements.length; ++i) {
- IConfigurationElement element= elements[i];
- if (isFortranProjectWizard(element)) {
- String id = element.getAttribute(TAG_ID);
- if (id != null && !idList.contains(id)) {
- idList.add(id);
- }
- }
- }
-
- return (String[]) idList.toArray(new String[idList.size()]);
- }
-
- private static IAction[] createActions(IConfigurationElement[] elements) {
- List idList = new ArrayList();
- List actionList = new ArrayList();
-
- // add Fortran wizards first
- for (int i = 0; i < elements.length; ++i) {
- IConfigurationElement element = elements[i];
- if (isFortranProjectWizard(element)) {
- String id = element.getAttribute(TAG_ID);
- if (id != null && !idList.contains(id)) {
- idList.add(id);
- IAction action = new OpenNewWizardAction(element);
- if (action != null) {
- actionList.add(action);
- }
- }
- }
- }
-
- return (IAction[]) actionList.toArray(new IAction[actionList.size()]);
- }
-
- /**
- * Returns extension data for all the Fortran wizards contributed to the workbench.
- * <wizard
- * name="My C Wizard"
- * icon="icons/cwiz.gif"
- * category="org.eclipse.cdt.ui.newCWizards"
- * id="xx.MyCWizard">
- * <description>
- * My C Wizard
- * </description>
- * </wizard>
- *
- * @return an array of IConfigurationElement
- */
- public static IConfigurationElement[] getAllWizardElements() {
- List elemList = new ArrayList();
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW);
- if (extensionPoint != null) {
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (element.getName().equals(TAG_WIZARD)) {
- String category = element.getAttribute(ATT_CATEGORY);
- if (category != null && category.equals(FORTRAN_WIZARD_CATEGORY_ID)) {
- String id = element.getAttribute(TAG_ID);
- elemList.add(element);
- }
- }
- }
- }
- return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
- }
-
+public class FortranWizardRegistry extends CWizardRegistry {
+//
+// public final static String FORTRAN_WIZARD_CATEGORY_ID = "org.eclipse.photran.ui.newFortranWizards"; //$NON-NLS-1$
+//
+// private final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$
+// private final static String ATT_CATEGORY = "category";//$NON-NLS-1$
+// private final static String ATT_PROJECT = "project";//$NON-NLS-1$
+// private final static String TAG_PARAMETER = "parameter";//$NON-NLS-1$
+// private final static String TAG_NAME = "name";//$NON-NLS-1$
+// private final static String TAG_VALUE = "value";//$NON-NLS-1$
+// private final static String ATT_FORTRAN_TYPE = "ctype";//$NON-NLS-1$
+// private final static String ATT_FORTRAN_FILE = "cfile";//$NON-NLS-1$
+// private final static String ATT_FORTRAN_FOLDER = "cfolder";//$NON-NLS-1$
+// private final static String ATT_FORTRAN_PROJECT = "cproject";//$NON-NLS-1$
+// private final static String TAG_CLASS = "class"; //$NON-NLS-1$
+// private final static String TAG_ID = "id"; //$NON-NLS-1$
+// private final static String PL_NEW = "newWizards"; //$NON-NLS-1$
+//
+// /**
+// * Checks if wizard supports Fortran projects.
+// *
+// * @param element the wizard element
+// *
+// * @return <code>true</code> if the given wizard element applies to a C Project
+// */
+// public static boolean isFortranProjectWizard(IConfigurationElement element) {
+// String category = element.getAttribute(ATT_CATEGORY);
+// return (category != null && category.equals(FORTRAN_WIZARD_CATEGORY_ID));
+// }
+//
+// /**
+// * Returns IDs of all Fortran project wizards contributed to the workbench.
+// *
+// * @return an array of wizard ids
+// */
+// public static String[] getProjectWizardIDs() {
+// return getWizardIDs(getProjectWizardElements());
+// }
+//
+// /**
+// * Returns extension data for all the Fortran project wizards contributed to the workbench.
+// * <wizard
+// * name="My C Wizard"
+// * icon="icons/cwiz.gif"
+// * category="org.eclipse.cdt.ui.newCWizards"
+// * id="xx.MyCWizard"
+// * class="org.xx.MyCWizard"
+// * project="true">
+// * <description>
+// * My C Wizard
+// * </description>
+// * </wizard>
+// *
+// *
+// * @return an array of IConfigurationElement
+// */
+// public static IConfigurationElement[] getProjectWizardElements() {
+// List elemList = new ArrayList();
+// IConfigurationElement[] elements = getAllWizardElements();
+// for (int i = 0; i < elements.length; ++i) {
+// IConfigurationElement element = elements[i];
+// if (isProjectWizard(element)) {
+// elemList.add(element);
+// }
+// }
+// return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
+// }
+//
+// private static boolean isProjectWizard(IConfigurationElement element) {
+// String project = element.getAttribute(ATT_PROJECT);
+// if (project != null) {
+// return Boolean.valueOf(project).booleanValue();
+// }
+//
+// IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
+// if (classElements.length > 0) {
+// for (int i = 0; i < classElements.length; i++) {
+// IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
+// for (int k = 0; k < paramElements.length; k++) {
+// IConfigurationElement curr = paramElements[k];
+// String name = curr.getAttribute(TAG_NAME);
+// if (name != null && (name.equals(ATT_FORTRAN_PROJECT))) {
+// String value = curr.getAttribute(TAG_VALUE);
+// if (value != null)
+// return Boolean.valueOf(value).booleanValue();
+// }
+// }
+// }
+// return false;
+// }
+// // fall back, if no <class> element found then assume it's a project wizard
+// return true;
+// }
+//
+// public static IAction[] getProjectWizardActions() {
+// return createActions(getProjectWizardElements());
+// }
+//
+// /**
+// * Returns IDs of all Fortran type wizards contributed to the workbench.
+// *
+// * @return an array of wizard ids
+// */
+// public static String[] getTypeWizardIDs() {
+// return getWizardIDs(getTypeWizardElements());
+// }
+//
+// /**
+// * Returns extension data for all the Fortran type wizards contributed to the workbench.
+// * <wizard
+// * name="My C Wizard"
+// * icon="icons/cwiz.gif"
+// * category="org.eclipse.cdt.ui.newCWizards"
+// * id="xx.MyCWizard">
+// * <class class="org.xx.MyCWizard">
+// * <parameter name="ctype" value="true" />
+// * </class>
+// * <description>
+// * My C Wizard
+// * </description>
+// * </wizard>
+// *
+// * @return an array of IConfigurationElement
+// */
+// public static IConfigurationElement[] getTypeWizardElements() {
+// List elemList = new ArrayList();
+// IConfigurationElement[] elements = getAllWizardElements();
+// for (int i = 0; i < elements.length; ++i) {
+// IConfigurationElement element = elements[i];
+// if (isTypeWizard(element)) {
+// elemList.add(element);
+// }
+// }
+// return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
+// }
+//
+// private static boolean isTypeWizard(IConfigurationElement element) {
+// IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
+// if (classElements.length > 0) {
+// for (int i = 0; i < classElements.length; i++) {
+// IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
+// for (int k = 0; k < paramElements.length; k++) {
+// IConfigurationElement curr = paramElements[k];
+// String name = curr.getAttribute(TAG_NAME);
+// if (name != null && name.equals(ATT_FORTRAN_TYPE)) {
+// String value = curr.getAttribute(TAG_VALUE);
+// if (value != null)
+// return Boolean.valueOf(value).booleanValue();
+// }
+// }
+// }
+// }
+// return false;
+// }
+//
+// public static IAction[] getTypeWizardActions() {
+// return createActions(getTypeWizardElements());
+// }
+//
+// /**
+// * Returns IDs of all Fortran file wizards contributed to the workbench.
+// *
+// * @return an array of wizard ids
+// */
+// public static String[] getFileWizardIDs() {
+// return getWizardIDs(getFileWizardElements());
+// }
+//
+// /**
+// * Returns extension data for all the Fortan file wizards contributed to the workbench.
+// * <wizard
+// * name="My C File Wizard"
+// * icon="icons/cwiz.gif"
+// * category="org.eclipse.cdt.ui.newCWizards"
+// * id="xx.MyCWizard">
+// * <class class="org.xx.MyCFileWizard">
+// * <parameter name="cfile" value="true" />
+// * </class>
+// * <description>
+// * My C File Wizard
+// * </description>
+// * </wizard>
+// *
+// * @return an array of IConfigurationElement
+// */
+// public static IConfigurationElement[] getFileWizardElements() {
+// List elemList = new ArrayList();
+// IConfigurationElement[] elements = getAllWizardElements();
+// for (int i = 0; i < elements.length; ++i) {
+// IConfigurationElement element = elements[i];
+// if (isFileWizard(element)) {
+// elemList.add(element);
+// }
+// }
+// return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
+// }
+//
+// private static boolean isFileWizard(IConfigurationElement element) {
+// IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
+// if (classElements.length > 0) {
+// for (int i = 0; i < classElements.length; i++) {
+// IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
+// for (int k = 0; k < paramElements.length; k++) {
+// IConfigurationElement curr = paramElements[k];
+// String name = curr.getAttribute(TAG_NAME);
+// if (name != null && name.equals(ATT_FORTRAN_FILE)) {
+// String value = curr.getAttribute(TAG_VALUE);
+// if (value != null)
+// return Boolean.valueOf(value).booleanValue();
+// }
+// }
+// }
+// }
+// return false;
+// }
+//
+// public static IAction[] getFolderWizardActions() {
+// return createActions(getFolderWizardElements());
+// }
+//
+// /**
+// * Returns IDs of all Fortran folder wizards contributed to the workbench.
+// *
+// * @return an array of wizard ids
+// */
+// public static String[] getFolderWizardIDs() {
+// return getWizardIDs(getFolderWizardElements());
+// }
+//
+// /**
+// * Returns extension data for all the Fortran folder wizards contributed to the workbench.
+// * <wizard
+// * name="My C Folder Wizard"
+// * icon="icons/cwiz.gif"
+// * category="org.eclipse.cdt.ui.newCWizards"
+// * id="xx.MyCWizard">
+// * <class class="org.xx.MyCFolderWizard">
+// * <parameter name="cfolder" value="true" />
+// * </class>
+// * <description>
+// * My C Folder Wizard
+// * </description>
+// * </wizard>
+// *
+// * @return an array of IConfigurationElement
+// */
+// public static IConfigurationElement[] getFolderWizardElements() {
+// List elemList = new ArrayList();
+// IConfigurationElement[] elements = getAllWizardElements();
+// for (int i = 0; i < elements.length; ++i) {
+// IConfigurationElement element = elements[i];
+// if (isFolderWizard(element)) {
+// elemList.add(element);
+// }
+// }
+// return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
+// }
+//
+// private static boolean isFolderWizard(IConfigurationElement element) {
+// IConfigurationElement[] classElements = element.getChildren(TAG_CLASS);
+// if (classElements.length > 0) {
+// for (int i = 0; i < classElements.length; i++) {
+// IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
+// for (int k = 0; k < paramElements.length; k++) {
+// IConfigurationElement curr = paramElements[k];
+// String name = curr.getAttribute(TAG_NAME);
+// if (name != null && name.equals(ATT_FORTRAN_FOLDER)) {
+// String value = curr.getAttribute(TAG_VALUE);
+// if (value != null)
+// return Boolean.valueOf(value).booleanValue();
+// }
+// }
+// }
+// }
+// return false;
+// }
+//
+// public static IAction[] getFileWizardActions() {
+// return createActions(getFileWizardElements());
+// }
+//
+// private static String[] getWizardIDs(IConfigurationElement[] elements) {
+// List idList = new ArrayList();
+//
+// // add Fortran wizards first
+// for (int i = 0; i < elements.length; ++i) {
+// IConfigurationElement element= elements[i];
+// if (isFortranProjectWizard(element)) {
+// String id = element.getAttribute(TAG_ID);
+// if (id != null && !idList.contains(id)) {
+// idList.add(id);
+// }
+// }
+// }
+//
+// return (String[]) idList.toArray(new String[idList.size()]);
+// }
+//
+// private static IAction[] createActions(IConfigurationElement[] elements) {
+// List idList = new ArrayList();
+// List actionList = new ArrayList();
+//
+// // add Fortran wizards first
+// for (int i = 0; i < elements.length; ++i) {
+// IConfigurationElement element = elements[i];
+// if (isFortranProjectWizard(element)) {
+// String id = element.getAttribute(TAG_ID);
+// if (id != null && !idList.contains(id)) {
+// idList.add(id);
+// IAction action = new OpenNewWizardAction(element);
+// if (action != null) {
+// actionList.add(action);
+// }
+// }
+// }
+// }
+//
+// return (IAction[]) actionList.toArray(new IAction[actionList.size()]);
+// }
+//
+// /**
+// * Returns extension data for all the Fortran wizards contributed to the workbench.
+// * <wizard
+// * name="My C Wizard"
+// * icon="icons/cwiz.gif"
+// * category="org.eclipse.cdt.ui.newCWizards"
+// * id="xx.MyCWizard">
+// * <description>
+// * My C Wizard
+// * </description>
+// * </wizard>
+// *
+// * @return an array of IConfigurationElement
+// */
+// public static IConfigurationElement[] getAllWizardElements() {
+// List elemList = new ArrayList();
+// IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW);
+// if (extensionPoint != null) {
+// IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
+// for (int i = 0; i < elements.length; i++) {
+// IConfigurationElement element= elements[i];
+// if (element.getName().equals(TAG_WIZARD)) {
+// String category = element.getAttribute(ATT_CATEGORY);
+// if (category != null && category.equals(FORTRAN_WIZARD_CATEGORY_ID)) {
+// String id = element.getAttribute(TAG_ID);
+// elemList.add(element);
+// }
+// }
+// }
+// }
+// return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
+// }
+//
}
diff --git a/org.eclipse.photran.core.intel/META-INF/MANIFEST.MF b/org.eclipse.photran.core.intel/META-INF/MANIFEST.MF
index e0918a8..18b15af 100644
--- a/org.eclipse.photran.core.intel/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.core.intel/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.photran.core.intel; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-ClassPath: photranIntel.jar
Bundle-Activator: org.eclipse.photran.core.intel.IntelPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.photran.core.vpg/META-INF/MANIFEST.MF b/org.eclipse.photran.core.vpg/META-INF/MANIFEST.MF
index 25eadfb..5c0396d 100644
--- a/org.eclipse.photran.core.vpg/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.core.vpg/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Photran Virtual Program Graph Core Plug-in
Bundle-SymbolicName: org.eclipse.photran.core.vpg;singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-Activator: org.eclipse.photran.core.vpg.Activator
Bundle-Vendor: University of Illinois at Urbana-Champaign and Los Alamos National Laboratory
Require-Bundle: org.eclipse.core.runtime,
diff --git a/org.eclipse.photran.core/META-INF/MANIFEST.MF b/org.eclipse.photran.core/META-INF/MANIFEST.MF
index b51efe6..a779ab0 100644
--- a/org.eclipse.photran.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Photran Core Plug-in
Bundle-SymbolicName: org.eclipse.photran.core; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-ClassPath: photrancore.jar
Bundle-Activator: org.eclipse.photran.core.FortranCorePlugin
Bundle-Vendor: University of Illinois at Urbana-Champaign and Los Alamos National Laboratory
diff --git a/org.eclipse.photran.errorparsers.xlf/META-INF/MANIFEST.MF b/org.eclipse.photran.errorparsers.xlf/META-INF/MANIFEST.MF
index 9fa0311..61c42a6 100755
--- a/org.eclipse.photran.errorparsers.xlf/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.errorparsers.xlf/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Xlf Plug-in
Bundle-SymbolicName: org.eclipse.photran.errorparsers.xlf; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-Activator: org.eclipse.photran.errorparsers.xlf.Activator
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
diff --git a/org.eclipse.photran.intel-feature/feature.xml b/org.eclipse.photran.intel-feature/feature.xml
index 595e78e..5f8d382 100644
--- a/org.eclipse.photran.intel-feature/feature.xml
+++ b/org.eclipse.photran.intel-feature/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.photran.intel"
label="%featureName"
- version="4.0.2"
+ version="4.0.3"
provider-name="%providerName"
os="linux">
@@ -19,7 +19,7 @@
</license>
<requires>
- <import feature="org.eclipse.photran_feature" version="4.0.0"/>
+ <import feature="org.eclipse.photran_feature" version="4.0.3"/>
</requires>
<plugin
@@ -28,7 +28,7 @@
arch="ia64,x86"
download-size="0"
install-size="0"
- version="4.0.2"/>
+ version="4.0.3"/>
<plugin
id="org.eclipse.photran.core.intel"
@@ -36,6 +36,6 @@
arch="ia64,x86"
download-size="0"
install-size="0"
- version="4.0.2"/>
+ version="4.0.3"/>
</feature>
diff --git a/org.eclipse.photran.managedbuilder.core/META-INF/MANIFEST.MF b/org.eclipse.photran.managedbuilder.core/META-INF/MANIFEST.MF
index ce8890a..01ecad0 100644
--- a/org.eclipse.photran.managedbuilder.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.managedbuilder.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Photran Managed Builder Core Plug-in
Bundle-SymbolicName: org.eclipse.photran.managedbuilder.core
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-Activator: org.eclipse.photran.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: University of Illinois at Urbana-Champaign and Los Alamos National Laboratory
Bundle-Localization: plugin
diff --git a/org.eclipse.photran.managedbuilder.gnu.ui/META-INF/MANIFEST.MF b/org.eclipse.photran.managedbuilder.gnu.ui/META-INF/MANIFEST.MF
index e646ed4..ca26791 100644
--- a/org.eclipse.photran.managedbuilder.gnu.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.managedbuilder.gnu.ui/META-INF/MANIFEST.MF
@@ -2,5 +2,5 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.photran.managedbuilder.gnu.ui; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-Localization: plugin
diff --git a/org.eclipse.photran.managedbuilder.intel.ui/META-INF/MANIFEST.MF b/org.eclipse.photran.managedbuilder.intel.ui/META-INF/MANIFEST.MF
index be87322..e1a7ce4 100644
--- a/org.eclipse.photran.managedbuilder.intel.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.managedbuilder.intel.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.photran.managedbuilder.intel.ui; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-ClassPath: intelui.jar
Bundle-Activator: org.eclipse.photran.managedbuilder.intel.ui.IntelUiPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.photran.managedbuilder.ui/META-INF/MANIFEST.MF b/org.eclipse.photran.managedbuilder.ui/META-INF/MANIFEST.MF
index c5f16d9..23b4e02 100644
--- a/org.eclipse.photran.managedbuilder.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.managedbuilder.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Photran Managed Builder UI Plug-in
Bundle-SymbolicName: org.eclipse.photran.managedbuilder.ui; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-ClassPath: photranmngbuildui.jar
Bundle-Activator: org.eclipse.photran.managedbuilder.internal.ui.ManagedBuilderUIPlugin
Bundle-Vendor: University of Illinois at Urbana-Champaign and Los Alamos National Laboratory
diff --git a/org.eclipse.photran.managedbuilder.xlf.ui/META-INF/MANIFEST.MF b/org.eclipse.photran.managedbuilder.xlf.ui/META-INF/MANIFEST.MF
index 029b22c..e364a5b 100644
--- a/org.eclipse.photran.managedbuilder.xlf.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.managedbuilder.xlf.ui/META-INF/MANIFEST.MF
@@ -2,6 +2,6 @@
Bundle-ManifestVersion: 2
Bundle-Name: IBM XL Compiler Tool Chain
Bundle-SymbolicName: org.eclipse.photran.managedbuilder.xlf.ui;singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-Vendor: LANL
Bundle-Localization: plugin
diff --git a/org.eclipse.photran.ui.vpg/META-INF/MANIFEST.MF b/org.eclipse.photran.ui.vpg/META-INF/MANIFEST.MF
index b1becee..9eaa9b4 100644
--- a/org.eclipse.photran.ui.vpg/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.ui.vpg/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Photran Virtual Program Graph UI Plug-in
Bundle-SymbolicName: org.eclipse.photran.ui.vpg;singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-Activator: org.eclipse.photran.ui.vpg.Activator
Bundle-Vendor: University of Illinois at Urbana-Champaign and Los Alamos National Laboratory
Require-Bundle: org.eclipse.ui,
diff --git a/org.eclipse.photran.ui.vpg/plugin.xml b/org.eclipse.photran.ui.vpg/plugin.xml
index 8e73a94..59926f1 100644
--- a/org.eclipse.photran.ui.vpg/plugin.xml
+++ b/org.eclipse.photran.ui.vpg/plugin.xml
@@ -204,7 +204,7 @@
sequence="M3+M2+I"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="org.eclipse.photran.ui.FortranEditorContext"
- commandId="org.eclipse.photran.ui.IntroduceImplicitNoneRefactoringCommand"
+ commandId="org.eclipse.photran.ui.IntroImplicitNoneRefactoringCommand"
/>
<key
sequence="M3+M2+R"
diff --git a/org.eclipse.photran.ui/META-INF/MANIFEST.MF b/org.eclipse.photran.ui/META-INF/MANIFEST.MF
index 364c8ef..a5c255c 100644
--- a/org.eclipse.photran.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.photran.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Photran UI Plug-in
Bundle-SymbolicName: org.eclipse.photran.ui; singleton:=true
-Bundle-Version: 4.0.2
+Bundle-Version: 4.0.3
Bundle-ClassPath: photranui.jar
Bundle-Activator: org.eclipse.photran.ui.FortranUIPlugin
Bundle-Vendor: University of Illinois at Urbana-Champaign and Los Alamos National Laboratory
diff --git a/org.eclipse.photran.ui/plugin.xml b/org.eclipse.photran.ui/plugin.xml
index bd0d766..84159a2 100644
--- a/org.eclipse.photran.ui/plugin.xml
+++ b/org.eclipse.photran.ui/plugin.xml
@@ -121,13 +121,6 @@
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="org.eclipse.photran.ui.FortranEditorContext"
commandId="org.eclipse.photran.ui.CommentCommand"/>
- <!-- The above don't seem to work anymore... something else is taking over those keystrokes,
- so install this one as well -->
- <key
- sequence="M1+M2+1"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- contextId="org.eclipse.photran.ui.FortranEditorContext"
- commandId="org.eclipse.photran.ui.CommentCommand"/>
</extension>
<!-- Define toggling a breakpoint as the default double-click action -->
diff --git a/org.eclipse.photran.ui/src/org/eclipse/photran/internal/ui/editor/AbstractFortranEditor.java b/org.eclipse.photran.ui/src/org/eclipse/photran/internal/ui/editor/AbstractFortranEditor.java
index c168fe3..72b313b 100644
--- a/org.eclipse.photran.ui/src/org/eclipse/photran/internal/ui/editor/AbstractFortranEditor.java
+++ b/org.eclipse.photran.ui/src/org/eclipse/photran/internal/ui/editor/AbstractFortranEditor.java
@@ -12,6 +12,8 @@
import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ISourceReference;
import org.eclipse.cdt.core.model.IWorkingCopy;
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
import org.eclipse.cdt.internal.ui.editor.CContentOutlinePage;
@@ -25,8 +27,10 @@
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.ITextViewerExtension2;
import org.eclipse.jface.text.MarginPainter;
@@ -42,7 +46,10 @@
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.photran.internal.core.preferences.FortranPreferences;
import org.eclipse.photran.internal.ui.actions.FortranBlockCommentActionDelegate;
@@ -57,6 +64,8 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPartService;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.part.IShowInSource;
@@ -65,6 +74,7 @@
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.eclipse.ui.texteditor.DefaultRangeIndicator;
import org.eclipse.ui.texteditor.IDocumentProvider;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
@@ -73,7 +83,7 @@
*
* @author Jeff Overbey
*/
-public abstract class AbstractFortranEditor extends TextEditor //implements ISelectionChangedListener
+public abstract class AbstractFortranEditor extends TextEditor implements ISelectionChangedListener
{
///////////////////////////////////////////////////////////////////////////////////////////////
// Constants
@@ -170,15 +180,15 @@
setKeyBindingScopes(new String[] { "org.eclipse.ui.textEditorScope", FORTRAN_EDITOR_CONTEXT_ID });
}
- /**
- * Create actions that will be registered with the editor.
- */
- protected void createActions()
- {
- super.createActions();
- createAction(new FortranBlockCommentActionDelegate(this), BLOCK_COMMENT_COMMAND_ID);
- //createAction(new FortranOpenDeclarationActionDelegate(this), OPEN_DECLARATION_COMMAND_ID);
- }
+// /**
+// * Create actions that will be registered with the editor.
+// */
+// protected void createActions()
+// {
+// super.createActions();
+// createAction(new FortranBlockCommentActionDelegate(this), BLOCK_COMMENT_COMMAND_ID);
+// //createAction(new FortranOpenDeclarationActionDelegate(this), OPEN_DECLARATION_COMMAND_ID);
+// }
protected void createAction(IAction action, String id)
{
@@ -369,7 +379,7 @@
public CContentOutlinePage getOutlinePage() {
if (fOutlinePage == null) {
fOutlinePage = new CContentOutlinePage(null);
- //fOutlinePage.addSelectionChangedListener(this);
+ fOutlinePage.addSelectionChangedListener(this);
}
setOutlinePageInput(fOutlinePage, getEditorInput());
return fOutlinePage;
@@ -388,14 +398,6 @@
}
}
-
-
-
-
-
-
-
-
// /**
// * Gets the outline page of the c-editor.
// *
@@ -431,124 +433,111 @@
// page.setInput(manager.getWorkingCopy(input));
// }
// }
-//
-// // ISelectionChangedListener Implementation ///////////////////////////////////////////////////
-// // (for updating editor when Outline clicked)
-//
-// public void selectionChanged(SelectionChangedEvent event) {
-// ISelection sel = event.getSelection();
-// if (sel instanceof IStructuredSelection) {
-// IStructuredSelection selection = (IStructuredSelection) sel;
-// Object obj = selection.getFirstElement();
-// if (obj instanceof ISourceReference) {
-// try {
-// ISourceRange range = ((ISourceReference) obj).getSourceRange();
-// if (range != null) {
-// setSelection(range, !isActivePart());
-// }
-// } catch (CModelException e) {
-// // Selection change not applied.
-// }
-// }
-// }
-// }
-//
-// /**
-// * Checks is the editor active part.
-// *
-// * @return <code>true</code> if editor is the active part of the
-// * workbench.
-// */
-// protected boolean isActivePart() {
-// IWorkbenchWindow window = getSite().getWorkbenchWindow();
-// IPartService service = window.getPartService();
-// return (this == service.getActivePart());
-// }
-//
-// /**
-// * Sets the current editor selection to the source range. Optionally sets
-// * the current editor position.
-// *
-// * @param element
-// * the source range to be shown in the editor, can be null.
-// * @param moveCursor
-// * if true the editor is scrolled to show the range.
-// */
-// public void setSelection(ISourceRange element, boolean moveCursor) {
-//
-// if (element == null) {
-// return;
-// }
-//
-// try {
-// IRegion alternateRegion = null;
-// int start = element.getStartPos();
-// int length = element.getLength();
-//
-// // Sanity check sometimes the parser may throw wrong numbers.
-// if (start < 0 || length < 0) {
-// start = 0;
-// length = 0;
-// }
-//
-// // 0 length and start and non-zero start line says we know
-// // the line for some reason, but not the offset.
-// if (length == 0 && start == 0 && element.getStartLine() > 0) {
-// // We have the information in term of lines, we can work it out.
-// // Binary elements return the first executable statement so we
-// // have to substract -1
-// start = getDocumentProvider().getDocument(getEditorInput())
-// .getLineOffset(element.getStartLine() - 1);
-// if (element.getEndLine() > 0) {
-// length = getDocumentProvider()
-// .getDocument(getEditorInput()).getLineOffset(
-// element.getEndLine())
-// - start;
-// } else {
-// length = start;
-// }
-// // create an alternate region for the keyword highlight.
-// alternateRegion = getDocumentProvider().getDocument(
-// getEditorInput()).getLineInformation(
-// element.getStartLine() - 1);
-// if (start == length || length < 0) {
-// if (alternateRegion != null) {
-// start = alternateRegion.getOffset();
-// length = alternateRegion.getLength();
-// }
-// }
-// }
-// setHighlightRange(start, length, moveCursor);
-//
-// if (moveCursor) {
-// start = element.getIdStartPos();
-// length = element.getIdLength();
-// if (start == 0 && length == 0 && alternateRegion != null) {
-// start = alternateRegion.getOffset();
-// length = alternateRegion.getLength();
-// }
-// if (start > -1 && getSourceViewer() != null) {
-// getSourceViewer().revealRange(start, length);
-// getSourceViewer().setSelectedRange(start, length);
-// }
-// // JO: This was used in CDT 3.3 and earlier
-// // Replaced constant with literal string since CTextEditorActionConstants no longer exists in CDT 4
-// //updateStatusField(CTextEditorActionConstants.STATUS_CURSOR_POS);
-// updateStatusField("CursorPosition");
-//
-// // JO: This is used in CDT 4.0 (7/18/07) according to CEditor.java
-// updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
-// }
-// return;
-// } catch (IllegalArgumentException x) {
-// // No information to the user
-// } catch (BadLocationException e) {
-// // No information to the user
-// }
-//
-// if (moveCursor)
-// resetHighlightRange();
-// }
+
+ // ISelectionChangedListener Implementation ///////////////////////////////////////////////////
+ // (for updating editor when Outline clicked)
+
+ /**
+ * React to changed selection in the outline view.
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection sel = event.getSelection();
+ if (sel instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) sel;
+ Object obj = selection.getFirstElement();
+ if (obj instanceof ISourceReference) {
+ try {
+ ISourceRange range = ((ISourceReference) obj).getSourceRange();
+ if (range != null) {
+ setSelection(range, !isActivePart());
+ }
+ } catch (CModelException e) {
+ // Selection change not applied.
+ }
+ }
+ }
+ }
+
+ /**
+ * Sets the current editor selection to the source range. Optionally
+ * sets the current editor position.
+ *
+ * @param element the source range to be shown in the editor, can be null.
+ * @param moveCursor if true the editor is scrolled to show the range.
+ */
+ public void setSelection(ISourceRange element, boolean moveCursor) {
+
+ if (element == null) {
+ return;
+ }
+
+ try {
+ IRegion alternateRegion = null;
+ int start = element.getStartPos();
+ int length = element.getLength();
+
+ // Sanity check sometimes the parser may throw wrong numbers.
+ if (start < 0 || length < 0) {
+ start = 0;
+ length = 0;
+ }
+
+ // 0 length and start and non-zero start line says we know
+ // the line for some reason, but not the offset.
+ if (length == 0 && start == 0 && element.getStartLine() > 0) {
+ // We have the information in term of lines, we can work it out.
+ // Binary elements return the first executable statement so we have to substract -1
+ start = getDocumentProvider().getDocument(getEditorInput()).getLineOffset(element.getStartLine() - 1);
+ if (element.getEndLine() > 0) {
+ length = getDocumentProvider().getDocument(getEditorInput()).getLineOffset(element.getEndLine()) - start;
+ } else {
+ length = start;
+ }
+ // create an alternate region for the keyword highlight.
+ alternateRegion = getDocumentProvider().getDocument(getEditorInput()).getLineInformation(element.getStartLine() - 1);
+ if (start == length || length < 0) {
+ if (alternateRegion != null) {
+ start = alternateRegion.getOffset();
+ length = alternateRegion.getLength();
+ }
+ }
+ }
+ setHighlightRange(start, length, moveCursor);
+
+ if (moveCursor) {
+ start = element.getIdStartPos();
+ length = element.getIdLength();
+ if (start == 0 && length == 0 && alternateRegion != null) {
+ start = alternateRegion.getOffset();
+ length = alternateRegion.getLength();
+ }
+ if (start > -1 && getSourceViewer() != null) {
+ getSourceViewer().revealRange(start, length);
+ getSourceViewer().setSelectedRange(start, length);
+ }
+ updateStatusField(ITextEditorActionConstants.STATUS_CATEGORY_INPUT_POSITION);
+ }
+ return;
+ } catch (IllegalArgumentException x) {
+ // No information to the user
+ } catch (BadLocationException e) {
+ // No information to the user
+ }
+
+ if (moveCursor)
+ resetHighlightRange();
+ }
+
+ /**
+ * Checks is the editor active part.
+ * @return <code>true</code> if editor is the active part of the workbench.
+ */
+ private boolean isActivePart() {
+ IWorkbenchWindow window = getSite().getWorkbenchWindow();
+ IPartService service = window.getPartService();
+ return (this == service.getActivePart());
+ }
///////////////////////////////////////////////////////////////////////////////////////////////
// Utility Methods