diff options
author | Jeffrey Overbey | 2014-07-17 03:31:14 +0000 |
---|---|---|
committer | Jeffrey Overbey | 2014-07-17 03:31:14 +0000 |
commit | 57a73099effb0f4890cf60f3f9e4bc342b84ed82 (patch) | |
tree | cc59e35caa5a23949f0a6a304f38a6af0cde5fc4 | |
parent | 608eba9b908b67f7487550fb07c60b7d2e1fcc43 (diff) | |
download | org.eclipse.photran-57a73099effb0f4890cf60f3f9e4bc342b84ed82.tar.gz org.eclipse.photran-57a73099effb0f4890cf60f3f9e4bc342b84ed82.tar.xz org.eclipse.photran-57a73099effb0f4890cf60f3f9e4bc342b84ed82.zip |
Deleted VPG extension point; hard-coded PhotranVPG
4 files changed, 3 insertions, 288 deletions
diff --git a/org.eclipse.photran.ui.vpg/plugin.xml b/org.eclipse.photran.ui.vpg/plugin.xml index 51cfaf0a..b48230fb 100644 --- a/org.eclipse.photran.ui.vpg/plugin.xml +++ b/org.eclipse.photran.ui.vpg/plugin.xml @@ -692,18 +692,6 @@ <!-- Debugging Actions in Refactoring Menu --> <!--=======================================--> - <!-- Contribution to the Rephraser Engine UI --> - <!-- This will automatically add some actions to the (Debugging) sub-menu of the Refactor --> - <!-- menu in the menu bar, such as Display VPG Database, Refresh VPG Database, etc. --> - <!-- All of these actions are language-independent. --> - <extension - point="org.eclipse.photran.ui.vpg.internal.vpg"> - <vpg - id="org.eclipse.photran.ui.vpg" - name="Fortran" - class="org.eclipse.photran.internal.ui.vpg.PhotranVPGContribution" /> - </extension> - <!-- Fortran-specific debugging actions --> <!-- These actions (e.g., Display Symbol Table and Resolve INTERFACE Binding) are --> <!-- Fortran-specific, but they are also contributed to the Refactor > (Debugging) --> @@ -979,11 +967,6 @@ <!-- VPG COMPONENT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - <!--===============================--> - <!-- VPG Extension Point --> - <!--===============================--> - <extension-point id="org.eclipse.photran.ui.vpg.internal.vpg" name="%rextension-point.name" schema="schema/vpg.exsd" /> - <!--=======================================--> <!-- Debugging Actions in Refactoring Menu --> <!--=======================================--> diff --git a/org.eclipse.photran.ui.vpg/rephraser/org/eclipse/rephraserengine/ui/actions/VPGWindowActionDelegate.java b/org.eclipse.photran.ui.vpg/rephraser/org/eclipse/rephraserengine/ui/actions/VPGWindowActionDelegate.java index c45db073..71551e41 100644 --- a/org.eclipse.photran.ui.vpg/rephraser/org/eclipse/rephraserengine/ui/actions/VPGWindowActionDelegate.java +++ b/org.eclipse.photran.ui.vpg/rephraser/org/eclipse/rephraserengine/ui/actions/VPGWindowActionDelegate.java @@ -11,32 +11,22 @@ package org.eclipse.rephraserengine.ui.actions; import java.lang.reflect.InvocationTargetException; -import java.util.Map; -import java.util.TreeMap; -import java.util.Map.Entry; import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.MultiRule; import org.eclipse.jface.action.IAction; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.Viewer; +import org.eclipse.photran.internal.core.vpg.PhotranVPG; import org.eclipse.rephraserengine.core.vpg.eclipse.EclipseVPG; import org.eclipse.rephraserengine.core.vpg.eclipse.VPGSchedulingRule; -import org.eclipse.rephraserengine.ui.IEclipseVPGFactory; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowActionDelegate; import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.ListDialog; import org.eclipse.ui.progress.IProgressService; /** @@ -58,8 +48,6 @@ public abstract class VPGWindowActionDelegate implements IWorkbenchWindowActionDelegate, IRunnableWithProgress { - private static final String VPG_EXTENSION_POINT_ID = "org.eclipse.photran.ui.vpg.internal.vpg"; //$NON-NLS-1$ - private EclipseVPG vpg = null; /** The active workbench window; may be <code>null</code> */ @@ -80,19 +68,8 @@ public abstract class VPGWindowActionDelegate public final void run(IAction action) { - vpg = determineVPG(); - - if (vpg == null) - { - MessageDialog.openError( - activeShell, - Messages.VPGWindowActionDelegate_ErrorTitle, - Messages.VPGWindowActionDelegate_NoVPGsAvailable); - } - else - { - scheduleThisUsingVPGSchedulingRule(); - } + vpg = PhotranVPG.getInstance(); + scheduleThisUsingVPGSchedulingRule(); } private void scheduleThisUsingVPGSchedulingRule() @@ -121,96 +98,6 @@ public abstract class VPGWindowActionDelegate } } - private EclipseVPG determineVPG() - { - IConfigurationElement[] configs = Platform.getExtensionRegistry().getConfigurationElementsFor(VPG_EXTENSION_POINT_ID); - if (configs.length == 0) - return null; - else - return createVPG(configs, determineWhichVPGToUse(configs)); - } - - private EclipseVPG createVPG(IConfigurationElement[] configs, int index) - { - try - { - if (index < 0) - { - return null; - } - else - { -// MessageDialog.openInformation( -// activeShell, -// "FYI", -// "You chose " + configs[index].getAttribute("name")); - - IEclipseVPGFactory factory = (IEclipseVPGFactory)configs[index].createExecutableExtension("class"); //$NON-NLS-1$ - return factory.getVPG(); - } - } - catch (CoreException e) - { - return null; - } - } - - private int determineWhichVPGToUse(IConfigurationElement[] configs) - { - if (configs.length == 1) - return 0; - else - return askUserWhichVPGToUse(configs); - } - - @SuppressWarnings("unchecked") - private int askUserWhichVPGToUse(IConfigurationElement[] configs) - { - Map<Integer, String> vpgs = new TreeMap<Integer, String>(); - for (int i = 0; i < configs.length; i++) - vpgs.put(i, configs[i].getAttribute("name")); //$NON-NLS-1$ - - ListDialog dlg = new ListDialog(activeShell); - dlg.setInput(vpgs); - dlg.setTitle(Messages.VPGWindowActionDelegate_SelectVPGTitle); - dlg.setContentProvider(new ArrayPairContentProvider()); - dlg.setLabelProvider(new ArrayPairLabelProvider()); - dlg.setMessage(Messages.VPGWindowActionDelegate_SelectDatabaseToUse); - dlg.setBlockOnOpen(true); - if (dlg.open() == ListDialog.OK - && dlg.getResult() != null - && dlg.getResult().length > 0) - { - return ((Entry<Integer, String>)dlg.getResult()[0]).getKey(); - } - else - { - return -1; - } - } - - private static final class ArrayPairContentProvider implements IStructuredContentProvider - { - @SuppressWarnings("unchecked") - public Object[] getElements(Object inputElement) - { - return ((Map<Integer, String>)inputElement).entrySet().toArray(); - } - - public void dispose() {;} - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {;} - } - - private static final class ArrayPairLabelProvider extends LabelProvider - { - @SuppressWarnings("unchecked") - @Override - public String getText(Object element) - { - return ((Entry<Integer, String>)element).getValue(); - } - } - public final void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException { try diff --git a/org.eclipse.photran.ui.vpg/schema/vpg.exsd b/org.eclipse.photran.ui.vpg/schema/vpg.exsd deleted file mode 100644 index f0a1978b..00000000 --- a/org.eclipse.photran.ui.vpg/schema/vpg.exsd +++ /dev/null @@ -1,125 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.rephraserengine.ui.vpg" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.rephraserengine.ui.vpg" id="vpg" name="VPG"/> - </appInfo> - <documentation> - Allows plug-ins to contribute a VPG to the common Rephraser Engine action set. - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appInfo> - <meta.element /> - </appInfo> - </annotation> - <complexType> - <sequence> - <element ref="vpg"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute translatable="true"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="vpg"> - <complexType> - <attribute name="id" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="class" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn=":org.eclipse.rephraserengine.ui.IEclipseVPGFactory"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - 1.0 - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - <!-- This will automatically add some actions to the (Debugging) sub-menu of the Refactor - menu in the menu bar, such as Display VPG Database, Refresh VPG Database, etc. --> - <extension - point="org.eclipse.rephraserengine.ui.vpg.vpg"> - <vpg - id="org.eclipse.photran.ui.vpg" - name="Fortran" - class="org.eclipse.photran.internal.ui.PhotranVPGContribution" /> - </extension> - - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiinfo"/> - </appInfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - -</schema> diff --git a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/vpg/PhotranVPGContribution.java b/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/vpg/PhotranVPGContribution.java deleted file mode 100644 index 80afc353..00000000 --- a/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/vpg/PhotranVPGContribution.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 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.vpg; - -import org.eclipse.photran.internal.core.vpg.PhotranVPG; -import org.eclipse.rephraserengine.core.vpg.eclipse.EclipseVPG; -import org.eclipse.rephraserengine.ui.IEclipseVPGFactory; - -/** - * This class gives the Rephraser Engine's common UI actions access to - * Photran's VPG. - * - * @author Jeff Overbey - */ -public class PhotranVPGContribution implements IEclipseVPGFactory -{ - @SuppressWarnings("rawtypes") - public EclipseVPG getVPG() - { - return PhotranVPG.getInstance(); - } -} |