Пример #1
0
  @Override
  public void run() {
    if (!MessageDialog.openConfirm(
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
        getText(),
        "Are you sure you want to delete?")) {
      return;
    }

    for (SimpleUserNode node : viewer.getSelectedTreeNodes()) {
      SimpleUserNode project = node.getAncestorOfType(ServoyProject.class);
      if (project == null) {
        continue;
      }

      Pair<Solution, String> pair = (Pair<Solution, String>) node.getRealObject();
      String scopeName = pair.getRight();

      WorkspaceFileAccess wsfa =
          new WorkspaceFileAccess(
              ((IProjectNature) project.getRealObject()).getProject().getWorkspace());
      String scriptPath =
          SolutionSerializer.getRelativePath(
                  ((((ServoyProject) project.getRealObject()).getSolution())), false)
              + scopeName
              + SolutionSerializer.JS_FILE_EXTENSION;
      try {
        wsfa.delete(scriptPath);
      } catch (IOException e) {
        ServoyLog.logError(
            "Could not delete scope '" + scopeName + "' from project '" + project.getName() + "'",
            e);
      }
    }
  }
 protected Image getImageForPersist(IPersist persist) {
   Pair<String, Image> elementNameAndImage = ElementUtil.getPersistNameAndImage(persist);
   String imageName = elementNameAndImage.getLeft();
   if (imageName == null) {
     imageName = "element.gif";
   } else return elementNameAndImage.getRight();
   Image img = Activator.getDefault().loadImageFromOldLocation(imageName);
   if (img == null) {
     img = Activator.getDefault().loadImageFromBundle(imageName);
   }
   return img;
 }