Пример #1
0
 /** Returns the string from the plugin's resource bundle, or 'key' if not found. */
 public static String getResourceString(final String key) {
   final ResourceBundle bundle = DebriefPlugin.getDefault().getResourceBundle();
   try {
     return (bundle != null) ? bundle.getString(key) : key;
   } catch (final MissingResourceException e) {
     return key;
   }
 }
Пример #2
0
 @Override
 protected void okPressed() {
   try {
     createProject();
   } catch (Exception e) {
     MessageDialog.openError(
         getShell(), "Error", "Can not create project. Error:" + e.getMessage());
     DebriefPlugin.logError(Status.ERROR, "Whilst create a project", e);
   }
   super.okPressed();
 }
Пример #3
0
  /*
   * (non-Javadoc)
   *
   * @see org.mwc.debrief.core.interfaces.IPlotLoader#loadFile(org.mwc.cmap.plotViewer.editors.CorePlotEditor,
   *      org.eclipse.ui.IEditorInput)
   */
  public void loadFile(
      final PlotEditor thePlot, final InputStream inputStream, final String fileName) {
    final Layers theLayers = (Layers) thePlot.getAdapter(Layers.class);

    try {

      // hmm, is there anything in the file?
      final int numAvailable = inputStream.available();
      if (numAvailable > 0) {

        final IWorkbench wb = PlatformUI.getWorkbench();
        final IProgressService ps = wb.getProgressService();
        ps.busyCursorWhile(
            new IRunnableWithProgress() {
              public void run(final IProgressMonitor pm) {
                // right, better suspend the LayerManager extended updates from
                // firing
                theLayers.suspendFiringExtended(true);

                try {
                  DebriefPlugin.logError(Status.INFO, "about to start loading:" + fileName, null);

                  // quick check, is this a KMZ
                  if (fileName.endsWith(".tif")) {
                    // create a layer name from the filename
                    File tmpFile = new File(fileName);
                    String layerName = tmpFile.getName();

                    // ok - get loading going
                    final ExternallyManagedDataLayer dl =
                        new ExternallyManagedDataLayer(
                            ChartBoundsWrapper.WORLDIMAGE_TYPE, layerName, fileName);
                    theLayers.addThisLayer(dl);
                  }

                  DebriefPlugin.logError(Status.INFO, "completed loading:" + fileName, null);

                  // and inform the plot editor
                  thePlot.loadingComplete(this);

                  DebriefPlugin.logError(Status.INFO, "parent plot informed", null);

                } catch (final RuntimeException e) {
                  DebriefPlugin.logError(Status.ERROR, "Problem loading datafile:" + fileName, e);
                } finally {
                  // ok, allow the layers object to inform anybody what's
                  // happening
                  // again
                  theLayers.suspendFiringExtended(false);

                  // and trigger an update ourselves
                  // theLayers.fireExtended();
                }
              }
            });
      }

    } catch (final InvocationTargetException e) {
      DebriefPlugin.logError(Status.ERROR, "Problem loading tif:" + fileName, e);
    } catch (final InterruptedException e) {
      DebriefPlugin.logError(Status.ERROR, "Problem loading tif:" + fileName, e);
    } catch (final IOException e) {
      DebriefPlugin.logError(Status.ERROR, "Problem loading tif:" + fileName, e);
    } finally {
    }
    //	}
    // ok, load the data...
    DebriefPlugin.logError(Status.INFO, "Successfully loaded tuf file", null);
  }