+ * + * SOFTWARE HISTORY + * + * Date Ticket# Engineer Description + * ------------ ---------- ----------- -------------------------- + * Nov 27, 2013 mschenke Methods extracted from LocalizationPerspectiveUtils + * + *+ * + * @author mschenke + * @version 1.0 + */ + +public class LocalizationEditorUtils { + + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(LocalizationEditorUtils.class); + + private static final String DEFAULT_TEXT_EDITOR = "org.eclipse.ui.DefaultTextEditor"; + + /** + * Get the editor descriptors for the localization file input + * + * @param input + * @return + */ + public static IEditorDescriptor[] getEditorsForInput( + LocalizationEditorInput input) { + IEditorRegistry reg = getEditorRegistry(); + if (reg == null) { + return new IEditorDescriptor[0]; + } + return reg.getEditors(input.getLocalizationFile().getName()); + } + + /** + * Get the default editor for the localization editor input + * + * @param input + * @return the default editor descriptor or null if none + */ + public static IEditorDescriptor getDefaultEditorForInput( + LocalizationEditorInput input) { + IEditorRegistry reg = getEditorRegistry(); + if (reg == null) { + return null; + } + return reg.getDefaultEditor(input.getLocalizationFile().getName()); + } + + /** + * Get the text editor descriptor + * + * @return the text editor descriptor or null if none + */ + public static IEditorDescriptor getTextEditorDescriptor() { + IEditorRegistry reg = getEditorRegistry(); + if (reg == null) { + return null; + } + return reg.findEditor(DEFAULT_TEXT_EDITOR); + } + + /** + * Opens an editor using the editor input and default editor associated with + * file extension + * + * @param page + * page to open in + * @param input + * input to open with + * @return null the opened editor or null no editor opened + */ + public static IEditorPart openInEditor(IWorkbenchPage page, + LocalizationEditorInput input) { + IEditorRegistry reg = getEditorRegistry(); + if (reg != null) { + IEditorDescriptor desc = reg.getDefaultEditor(input + .getLocalizationFile().getName()); + String id = DEFAULT_TEXT_EDITOR; + if (desc != null) { + id = desc.getId(); + } + return openInEditor(page, input, id); + } + return null; + } + + /** + * Open an editor given the input and editor id, activate editor if already + * opened + * + * @param page + * @param input + * @param editorId + * @return + */ + public static IEditorPart openInEditor(IWorkbenchPage page, + LocalizationEditorInput input, String editorId) { + IEditorPart rval = null; + IEditorPart existingPart = null; + try { + input.getFile().refreshLocal(IResource.DEPTH_ZERO, null); + existingPart = getEditorForFile(page, input.getLocalizationFile()); + if ((existingPart != null) + && existingPart.getEditorSite().getId().equals(editorId)) { + page.activate(existingPart); + rval = existingPart; + } else { + rval = page.openEditor(input, editorId, true); + } + } catch (PartInitException e) { + statusHandler.handle(Priority.PROBLEM, + "Error opening editor for file: " + input.getName(), e); + } catch (CoreException e) { + // Ignore exception from refreshing the file + } + + return rval; + } + + /** + * Get the workbench editor registry + * + * @return + */ + public static IEditorRegistry getEditorRegistry() { + return PlatformUI.getWorkbench().getEditorRegistry(); + } + + /** + * Get the open editor editing the file + * + * @param file + * @return the open editor part or null if not being edited + */ + public static IEditorPart getEditorForFile(IWorkbenchPage page, + LocalizationFile file) { + for (IEditorReference ref : page.getEditorReferences()) { + IEditorPart part = ref.getEditor(false); + if (part != null) { + IEditorInput input = part.getEditorInput(); + if (input instanceof LocalizationEditorInput) { + LocalizationFile editedFile = ((LocalizationEditorInput) input) + .getLocalizationFile(); + if (editedFile.getContext().equals(file.getContext()) + && editedFile.getName().equals(file.getName())) { + return part; + } + } + } + } + return null; + } + +} diff --git a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/LocalizationSaveAsPopulator.java b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/LocalizationSaveAsPopulator.java index ad98fda076..b1023b8475 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/LocalizationSaveAsPopulator.java +++ b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/LocalizationSaveAsPopulator.java @@ -55,8 +55,8 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.localization.LocalizationManager; -import com.raytheon.uf.viz.localization.LocalizationEditorInput; import com.raytheon.uf.viz.localization.LocalizationPerspectiveUtils; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput; import com.raytheon.uf.viz.localization.service.ILocalizationService; import com.raytheon.viz.ui.EditorUtil; diff --git a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/compare/LocalizationCompareEditorInput.java b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/compare/LocalizationCompareEditorInput.java index 97f2af3387..75bb506486 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/compare/LocalizationCompareEditorInput.java +++ b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/ui/compare/LocalizationCompareEditorInput.java @@ -27,7 +27,7 @@ import org.eclipse.compare.ResourceNode; import org.eclipse.compare.structuremergeviewer.DiffNode; import org.eclipse.core.runtime.IProgressMonitor; -import com.raytheon.uf.viz.localization.LocalizationEditorInput; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput; /** * Comparing editor input for localization files diff --git a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java index 44005615b2..8d205d983d 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java +++ b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/FileTreeView.java @@ -100,14 +100,14 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; -import com.raytheon.uf.viz.localization.LocalizationEditorInput; -import com.raytheon.uf.viz.localization.LocalizationPerspectiveUtils; import com.raytheon.uf.viz.localization.adapter.LocalizationPerspectiveAdapter; import com.raytheon.uf.viz.localization.filetreeview.FileTreeEntryData; import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileEntryData; import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileGroupData; import com.raytheon.uf.viz.localization.filetreeview.PathData; import com.raytheon.uf.viz.localization.perspective.Activator; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorUtils; import com.raytheon.uf.viz.localization.perspective.ui.compare.LocalizationCompareEditorInput; import com.raytheon.uf.viz.localization.perspective.view.actions.CopyToAction; import com.raytheon.uf.viz.localization.perspective.view.actions.DeleteAction; @@ -1371,7 +1371,7 @@ public class FileTreeView extends ViewPart implements IPartListener2, if (filePath == null) { return directoryImage; } - ImageDescriptor desc = LocalizationPerspectiveUtils.getEditorRegistry() + ImageDescriptor desc = LocalizationEditorUtils.getEditorRegistry() .getImageDescriptor(filePath); if (desc != null) { Image img = imageMap.get(desc); @@ -1746,7 +1746,7 @@ public class FileTreeView extends ViewPart implements IPartListener2, if (item.getData() instanceof LocalizationFileEntryData) { LocalizationFileEntryData fileData = (LocalizationFileEntryData) item .getData(); - LocalizationPerspectiveUtils.openInEditor( + LocalizationEditorUtils.openInEditor( page, new LocalizationEditorInput(file, fileData .getResource())); diff --git a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/DeleteAction.java b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/DeleteAction.java index 22139dbc5f..7e653dda4d 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/DeleteAction.java +++ b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/DeleteAction.java @@ -41,7 +41,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.localization.LocalizationEditorInput; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput; /** * Deletes the selected localation file diff --git a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenAction.java b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenAction.java index bce78c508f..1ec1ef3211 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenAction.java +++ b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenAction.java @@ -23,9 +23,9 @@ import org.eclipse.jface.action.Action; import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IWorkbenchPage; -import com.raytheon.uf.viz.localization.LocalizationEditorInput; -import com.raytheon.uf.viz.localization.LocalizationPerspectiveUtils; import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileEntryData; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorUtils; /** * Action to open a localization file in the default editor (based on file @@ -76,19 +76,19 @@ public class OpenAction extends Action { public void run() { if (descriptor == null) { for (LocalizationFileEntryData file : files) { - LocalizationPerspectiveUtils.openInEditor( + LocalizationEditorUtils.openInEditor( page, new LocalizationEditorInput(file.getFile(), file .getResource())); } } else { for (LocalizationFileEntryData file : files) { - LocalizationPerspectiveUtils.openInEditor( + LocalizationEditorUtils.openInEditor( page, new LocalizationEditorInput(file.getFile(), file .getResource()), descriptor.getId()); - LocalizationPerspectiveUtils.getEditorRegistry() - .setDefaultEditor(file.getName(), descriptor.getId()); + LocalizationEditorUtils.getEditorRegistry().setDefaultEditor( + file.getName(), descriptor.getId()); } } } diff --git a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenWithAction.java b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenWithAction.java index 2fc3bfe57a..58804dae4a 100644 --- a/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenWithAction.java +++ b/cave/com.raytheon.uf.viz.localization.perspective/src/com/raytheon/uf/viz/localization/perspective/view/actions/OpenWithAction.java @@ -33,10 +33,10 @@ import org.eclipse.ui.IEditorRegistry; import org.eclipse.ui.IWorkbenchPage; import com.raytheon.uf.common.localization.LocalizationFile; -import com.raytheon.uf.viz.localization.LocalizationEditorInput; -import com.raytheon.uf.viz.localization.LocalizationPerspectiveUtils; import com.raytheon.uf.viz.localization.adapter.LocalizationPerspectiveAdapter; import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileEntryData; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorInput; +import com.raytheon.uf.viz.localization.perspective.editor.LocalizationEditorUtils; /** * Action to open a localization file in a specified editor, lists available @@ -136,11 +136,11 @@ public class OpenWithAction extends Action implements IMenuCreator { LocalizationEditorInput input = new LocalizationEditorInput(file, this.file.getResource()); IEditorDescriptor[] adapterDescriptors = adapter.getLoadableEditors( - LocalizationPerspectiveUtils.getEditorRegistry(), file); - IEditorDescriptor[] descriptors = LocalizationPerspectiveUtils + LocalizationEditorUtils.getEditorRegistry(), file); + IEditorDescriptor[] descriptors = LocalizationEditorUtils .getEditorsForInput(input); - IEditorDescriptor defaultEditor = LocalizationPerspectiveUtils + IEditorDescriptor defaultEditor = LocalizationEditorUtils .getDefaultEditorForInput(input); IEditorDescriptor systemEditor = new SystemEditorDescriptor( "System Editor"); @@ -148,7 +148,7 @@ public class OpenWithAction extends Action implements IMenuCreator { defaultEditor = new SystemEditorDescriptor("Default Editor"); } if (descriptors.length == 0) { - descriptors = new IEditorDescriptor[] { LocalizationPerspectiveUtils + descriptors = new IEditorDescriptor[] { LocalizationEditorUtils .getTextEditorDescriptor() }; } diff --git a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/component/CAVEApplication.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/component/CAVEApplication.java index 1582045cdc..4b49ffe5e5 100644 --- a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/component/CAVEApplication.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/component/CAVEApplication.java @@ -49,8 +49,8 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.SimulatedTime; -import com.raytheon.uf.viz.application.ProgramArguments; import com.raytheon.uf.viz.application.component.IStandaloneComponent; +import com.raytheon.uf.viz.core.ProgramArguments; import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver; diff --git a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchAdvisor.java b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchAdvisor.java index 1032a6b61d..3cb7b66abb 100644 --- a/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchAdvisor.java +++ b/cave/com.raytheon.uf.viz.personalities.cave/src/com/raytheon/uf/viz/personalities/cave/workbench/VizWorkbenchAdvisor.java @@ -37,7 +37,7 @@ import org.eclipse.ui.application.WorkbenchWindowAdvisor; import org.eclipse.ui.contexts.IContextService; import com.raytheon.uf.common.time.util.ITimer; -import com.raytheon.uf.viz.application.ProgramArguments; +import com.raytheon.uf.viz.core.ProgramArguments; import com.raytheon.uf.viz.core.globals.VizGlobalsManager; import com.raytheon.uf.viz.ui.menus.DiscoverMenuContributions; import com.raytheon.viz.ui.VizWorkbenchManager; diff --git a/cave/com.raytheon.uf.viz.product.alertviz/src/com/raytheon/uf/viz/product/alertviz/AlertVizApplication.java b/cave/com.raytheon.uf.viz.product.alertviz/src/com/raytheon/uf/viz/product/alertviz/AlertVizApplication.java index a1378d8954..56f3c39008 100644 --- a/cave/com.raytheon.uf.viz.product.alertviz/src/com/raytheon/uf/viz/product/alertviz/AlertVizApplication.java +++ b/cave/com.raytheon.uf.viz.product.alertviz/src/com/raytheon/uf/viz/product/alertviz/AlertVizApplication.java @@ -38,8 +38,8 @@ import com.raytheon.uf.viz.alertviz.AlertvizJob; import com.raytheon.uf.viz.alertviz.Container; import com.raytheon.uf.viz.alertviz.SystemStatusHandler; import com.raytheon.uf.viz.alertviz.ui.dialogs.AlertVisualization; -import com.raytheon.uf.viz.application.ProgramArguments; import com.raytheon.uf.viz.application.component.IStandaloneComponent; +import com.raytheon.uf.viz.core.ProgramArguments; import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver; import com.raytheon.uf.viz.core.localization.LocalizationConstants; import com.raytheon.uf.viz.core.localization.LocalizationInitializer; diff --git a/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF index 0c9452c726..51296d91cb 100644 --- a/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF @@ -14,7 +14,6 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.colormap;bundle-version="1.0.0", com.raytheon.uf.viz.core, com.raytheon.uf.common.util;bundle-version="1.0.0", - com.raytheon.uf.viz.application;bundle-version="1.0.0", com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", javax.measure;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy diff --git a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java index 553f339c9c..f11db22269 100644 --- a/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java +++ b/cave/com.raytheon.viz.core.gl/src/com/raytheon/viz/core/gl/internal/GLTarget.java @@ -58,7 +58,6 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.application.ProgramArguments; import com.raytheon.uf.viz.core.AbstractGraphicsTarget; import com.raytheon.uf.viz.core.Activator; import com.raytheon.uf.viz.core.DrawableCircle; @@ -68,6 +67,7 @@ import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IView; +import com.raytheon.uf.viz.core.ProgramArguments; import com.raytheon.uf.viz.core.data.IRenderedImageCallback; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IFont; diff --git a/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF index 87cb9ae756..8abb2f61d1 100644 --- a/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF @@ -27,7 +27,6 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.colormap;bundle-version="1.0.0", com.raytheon.uf.common.serialization.comm, org.eclipse.core.expressions, - com.raytheon.uf.viz.application;bundle-version="1.0.0", com.raytheon.uf.common.topo;bundle-version="1.12.1174", com.raytheon.uf.common.style;bundle-version="1.0.0" Eclipse-BuddyPolicy: ext, registered, global diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/mode/CAVEMode.java b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/mode/CAVEMode.java index 8555f7c4c2..f310382813 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/mode/CAVEMode.java +++ b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/mode/CAVEMode.java @@ -26,7 +26,7 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import com.raytheon.uf.viz.application.ProgramArguments; +import com.raytheon.uf.viz.core.ProgramArguments; /** * CAVEMode. diff --git a/cave/com.raytheon.viz.feature.awips.developer/feature.xml b/cave/com.raytheon.viz.feature.awips.developer/feature.xml index 73170fb2d2..17cf845de2 100644 --- a/cave/com.raytheon.viz.feature.awips.developer/feature.xml +++ b/cave/com.raytheon.viz.feature.awips.developer/feature.xml @@ -3,8 +3,7 @@ id="com.raytheon.viz.feature.awips.developer" label="AWIPS Developer Feature" version="1.9.0.qualifier" - provider-name="Raytheon" - plugin="com.raytheon.viz.ui.personalities.awips"> + provider-name="Raytheon">
* * SOFTWARE HISTORY * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Nov 2, 2010 mschenke Initial creation + * Nov 2, 2010 mschenke Initial creation + * Nov 27, 2013 mschenke Moved editor based utility methods to + * perspective project * ** @@ -65,143 +56,6 @@ public class LocalizationPerspectiveUtils { public static final String ID_PERSPECTIVE = "com.raytheon.uf.viz.ui.LocalizationPerspective"; //$NON-NLS-1$ - private static final String DEFAULT_TEXT_EDITOR = "org.eclipse.ui.DefaultTextEditor"; - - /** - * Get the editor descriptors for the localization file input - * - * @param input - * @return - */ - public static IEditorDescriptor[] getEditorsForInput( - LocalizationEditorInput input) { - IEditorRegistry reg = getEditorRegistry(); - if (reg == null) { - return new IEditorDescriptor[0]; - } - return reg.getEditors(input.getLocalizationFile().getName()); - } - - /** - * Get the default editor for the localization editor input - * - * @param input - * @return the default editor descriptor or null if none - */ - public static IEditorDescriptor getDefaultEditorForInput( - LocalizationEditorInput input) { - IEditorRegistry reg = getEditorRegistry(); - if (reg == null) { - return null; - } - return reg.getDefaultEditor(input.getLocalizationFile().getName()); - } - - /** - * Get the text editor descriptor - * - * @return the text editor descriptor or null if none - */ - public static IEditorDescriptor getTextEditorDescriptor() { - IEditorRegistry reg = getEditorRegistry(); - if (reg == null) { - return null; - } - return reg.findEditor(DEFAULT_TEXT_EDITOR); - } - - /** - * Opens an editor using the editor input and default editor associated with - * file extension - * - * @param page - * page to open in - * @param input - * input to open with - * @return null the opened editor or null no editor opened - */ - public static IEditorPart openInEditor(IWorkbenchPage page, - LocalizationEditorInput input) { - IEditorRegistry reg = getEditorRegistry(); - if (reg != null) { - IEditorDescriptor desc = reg.getDefaultEditor(input - .getLocalizationFile().getName()); - String id = DEFAULT_TEXT_EDITOR; - if (desc != null) { - id = desc.getId(); - } - return openInEditor(page, input, id); - } - return null; - } - - /** - * Open an editor given the input and editor id, activate editor if already - * opened - * - * @param page - * @param input - * @param editorId - * @return - */ - public static IEditorPart openInEditor(IWorkbenchPage page, - LocalizationEditorInput input, String editorId) { - IEditorPart rval = null; - IEditorPart existingPart = null; - try { - input.getFile().refreshLocal(IResource.DEPTH_ZERO, null); - existingPart = getEditorForFile(page, input.getLocalizationFile()); - if ((existingPart != null) - && existingPart.getEditorSite().getId().equals(editorId)) { - page.activate(existingPart); - rval = existingPart; - } else { - rval = page.openEditor(input, editorId, true); - } - } catch (PartInitException e) { - statusHandler.handle(Priority.PROBLEM, - "Error opening editor for file: " + input.getName(), e); - } catch (CoreException e) { - // Ignore exception from refreshing the file - } - - return rval; - } - - /** - * Get the workbench editor registry - * - * @return - */ - public static IEditorRegistry getEditorRegistry() { - return PlatformUI.getWorkbench().getEditorRegistry(); - } - - /** - * Get the open editor editing the file - * - * @param file - * @return the open editor part or null if not being edited - */ - public static IEditorPart getEditorForFile(IWorkbenchPage page, - LocalizationFile file) { - for (IEditorReference ref : page.getEditorReferences()) { - IEditorPart part = ref.getEditor(false); - if (part != null) { - IEditorInput input = part.getEditorInput(); - if (input instanceof LocalizationEditorInput) { - LocalizationFile editedFile = ((LocalizationEditorInput) input) - .getLocalizationFile(); - if (editedFile.getContext().equals(file.getContext()) - && editedFile.getName().equals(file.getName())) { - return part; - } - } - } - } - return null; - } - /** * Get a localization service object from the active window * diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java index 70f09b2438..31d342f929 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AWIPSWorkbenchAdvisor.java @@ -35,8 +35,8 @@ import org.eclipse.ui.contexts.IContextService; import com.raytheon.uf.common.menus.MenuCreationRequest; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.application.ProgramArguments; import com.raytheon.uf.viz.core.Activator; +import com.raytheon.uf.viz.core.ProgramArguments; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.preferences.PreferenceConstants; diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java index 3e4d6cfbdb..ac4e05cd22 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java @@ -49,8 +49,8 @@ import com.raytheon.uf.common.time.util.ITimer; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.viz.alertviz.SystemStatusHandler; import com.raytheon.uf.viz.alertviz.ui.dialogs.AlertVisualization; -import com.raytheon.uf.viz.application.ProgramArguments; import com.raytheon.uf.viz.application.component.IStandaloneComponent; +import com.raytheon.uf.viz.core.ProgramArguments; import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver; diff --git a/ncep/gov.noaa.nws.ncep.viz.localization/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.localization/META-INF/MANIFEST.MF index cd05e2210d..def25e593c 100644 --- a/ncep/gov.noaa.nws.ncep.viz.localization/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.localization/META-INF/MANIFEST.MF @@ -7,8 +7,7 @@ Bundle-Activator: gov.noaa.nws.ncep.viz.localization.Activator Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui;bundle-version="3.6.1", com.raytheon.viz.ui;bundle-version="1.12.1174", - com.raytheon.uf.viz.core;bundle-version="1.12.1174", - com.raytheon.uf.viz.application;bundle-version="1.0.0" + com.raytheon.uf.viz.core;bundle-version="1.12.1174" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: gov.noaa.nws.ncep.viz.localization diff --git a/ncep/gov.noaa.nws.ncep.viz.localization/src/gov/noaa/nws/ncep/viz/localization/Activator.java b/ncep/gov.noaa.nws.ncep.viz.localization/src/gov/noaa/nws/ncep/viz/localization/Activator.java index d82b73e5f0..91a98de9d6 100644 --- a/ncep/gov.noaa.nws.ncep.viz.localization/src/gov/noaa/nws/ncep/viz/localization/Activator.java +++ b/ncep/gov.noaa.nws.ncep.viz.localization/src/gov/noaa/nws/ncep/viz/localization/Activator.java @@ -1,18 +1,12 @@ package gov.noaa.nws.ncep.viz.localization; //import gov.noaa.nws.ncep.viz.localization.adapter.NcepCAVELocalizationAdapter; -import java.io.File; -import java.io.IOException; - import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Plugin; import org.osgi.framework.BundleContext; +import com.raytheon.uf.viz.core.ProgramArguments; //import com.raytheon.uf.common.localization.IPathManager; -import com.raytheon.uf.common.localization.LocalizationContext; -import com.raytheon.uf.common.localization.PathManagerFactory; -import com.raytheon.uf.viz.application.ProgramArguments; -import com.raytheon.uf.viz.core.localization.LocalizationManager; /** * The activator class controls the plug-in life cycle diff --git a/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/META-INF/MANIFEST.MF index 94dab2caac..da1e6e5c2e 100644 --- a/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/META-INF/MANIFEST.MF @@ -19,7 +19,6 @@ Require-Bundle: org.eclipse.ui, gov.noaa.nws.ncep.viz.overlays;bundle-version="1.0.0", com.raytheon.viz.alerts, com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0", - com.raytheon.uf.viz.application;bundle-version="1.0.0", gov.noaa.nws.ncep.viz.resourceManager;bundle-version="1.0.0", gov.noaa.nws.ncep.staticdataprovider;bundle-version="1.0.0", com.raytheon.viz.ui.personalities.awips diff --git a/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NCPerspectiveManager.java b/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NCPerspectiveManager.java index 6d06923c3c..95cfc13e92 100644 --- a/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NCPerspectiveManager.java +++ b/ncep/gov.noaa.nws.ncep.viz.ui.perspectives/src/gov/noaa/nws/ncep/viz/ui/perspectives/NCPerspectiveManager.java @@ -45,7 +45,7 @@ import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.application.ProgramArguments; +import com.raytheon.uf.viz.core.ProgramArguments; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IVizEditorChangedListener;