@Override
 public void run() {
   SimpleUserNode node = viewer.getSelectedTreeNode();
   if (node.getRealObject() instanceof IServerInternal) {
     show();
   }
 }
Пример #2
0
 private void open(SimpleUserNode node) {
   if (node != null) {
     IPersist persist = (IPersist) node.getRealObject();
     if (node.getType() == UserNodeType.STYLE_ITEM) {
       EditorUtil.openStyleEditor((Style) persist);
     }
   }
 }
Пример #3
0
 protected boolean calculateEnabled(SelectionChangedEvent event) {
   IStructuredSelection sel = (IStructuredSelection) event.getSelection();
   if (sel.size() == 0) {
     return false;
   }
   Iterator<SimpleUserNode> nodes = sel.iterator();
   while (nodes.hasNext()) {
     SimpleUserNode node = nodes.next();
     if (node.getType() != UserNodeType.GLOBALS_ITEM) {
       return false;
     }
   }
   return true;
 }
 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);
 }
Пример #5
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);
      }
    }
  }