コード例 #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);
      }
    }
  }
コード例 #2
0
 @Override
 public void run() {
   SimpleUserNode node = viewer.getSelectedTreeNode();
   if (node.getRealObject() instanceof IServerInternal) {
     show();
   }
 }
コード例 #3
0
 private void open(SimpleUserNode node) {
   if (node != null) {
     IPersist persist = (IPersist) node.getRealObject();
     if (node.getType() == UserNodeType.STYLE_ITEM) {
       EditorUtil.openStyleEditor((Style) persist);
     }
   }
 }
コード例 #4
0
 public void selectionChanged(SelectionChangedEvent event) {
   IStructuredSelection sel = (IStructuredSelection) event.getSelection();
   boolean state = false;
   if (sel.size() == 1) {
     SimpleUserNode node = (SimpleUserNode) sel.getFirstElement();
     if (node.getRealObject() instanceof IServerInternal) {
       IServerInternal s = (IServerInternal) node.getRealObject();
       if (s.isValid()
           && s.getConfig().isEnabled()
           && ServoyModelManager.getServoyModelManager().getServoyModel().getActiveProject()
               != null) {
         state = true;
       }
     }
   }
   setEnabled(state);
 }