コード例 #1
0
        public void execute() {
          solutionTree.setShowLocalizedFileNames(!solutionTree.isShowLocalizedFileNames());

          // update setting
          final String url =
              GWT.getHostPageBaseURL()
                  + "api/user-settings/MANTLE_SHOW_LOCALIZED_FILENAMES"; //$NON-NLS-1$
          RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
          try {
            builder.sendRequest(
                "" + solutionTree.isShowLocalizedFileNames(), EmptyRequestCallback.getInstance());
          } catch (RequestException e) {
            // showError(e);
          }
        }
コード例 #2
0
        public void execute() {
          solutionTree.setUseDescriptionsForTooltip(!solutionTree.isUseDescriptionsForTooltip());
          solutionTree.setSelectedItem(solutionTree.getSelectedItem(), true);

          // update setting
          final String url =
              GWT.getHostPageBaseURL()
                  + "api/user-settings/MANTLE_SHOW_DESCRIPTIONS_FOR_TOOLTIPS"; //$NON-NLS-1$
          RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
          try {
            builder.sendRequest(
                "" + solutionTree.isUseDescriptionsForTooltip(),
                EmptyRequestCallback.getInstance());
          } catch (RequestException e) {
            // showError(e);
          }
        }
コード例 #3
0
  private SolutionBrowserPanel() {
    RootPanel.get().getElement().getStyle().setProperty("position", "relative");
    dragController = new SolutionBrowserDragController(contentTabPanel);
    instance = this;

    ExecuteUrlInNewTabCommand.setupNativeHooks();
    SolutionBrowserPanel.setupNativeHooks(this);

    solutionTree.addTreeListener(treeListener);
    initializeExecutableFileTypes();
    buildUI();
  }
コード例 #4
0
        public void execute() {
          filesListPanel.setShowHiddenFiles(!solutionTree.isShowHiddenFiles());
          solutionTree.setShowHiddenFiles(!solutionTree.isShowHiddenFiles());
          solutionTree.setSelectedItem(solutionTree.getSelectedItem(), true);

          // update setting
          final String url =
              GWT.getHostPageBaseURL()
                  + "api/user-settings/MANTLE_SHOW_HIDDEN_FILES"; //$NON-NLS-1$
          RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);
          try {
            builder.sendRequest(
                "" + solutionTree.isShowHiddenFiles(), EmptyRequestCallback.getInstance());
            RepositoryFileTreeManager.getInstance()
                .fetchRepositoryFileTree(true, null, null, solutionTree.isShowHiddenFiles());
          } catch (RequestException e) {
            // showError(e);
          }
        }
コード例 #5
0
 public void setAdministrator(boolean isAdministrator) {
   this.isAdministrator = isAdministrator;
   solutionTree.setAdministrator(isAdministrator);
 }
コード例 #6
0
 public void onTreeItemStateChanged(TreeItem item) {
   solutionTree.setSelectedItem(item, false);
 }
コード例 #7
0
 public void onTreeItemSelected(TreeItem item) {
   filesListPanel.setShowHiddenFiles(solutionTree.isShowHiddenFiles());
   filesListPanel.populateFilesList(SolutionBrowserPanel.this, solutionTree, item);
   filesListPanel.getToolbar().setEnabled(false);
 }
コード例 #8
0
  @SuppressWarnings("unchecked")
  public void populateFilesList(
      SolutionBrowserPerspective perspective, SolutionTree solutionTree, TreeItem item) {
    filesList.clear();
    ArrayList<Element> files = (ArrayList<Element>) item.getUserObject();
    // let's sort this list based on localized name
    Collections.sort(
        files,
        new Comparator<Element>() {
          public int compare(Element o1, Element o2) {
            String name1 = o1.getAttribute("localized-name"); // $NON-NLS-1$
            String name2 = o2.getAttribute("localized-name"); // $NON-NLS-1$
            return name1.compareTo(name2);
          }
        });
    if (files != null) {
      int rowCounter = 0;
      for (int i = 0; i < files.size(); i++) {
        Element fileElement = files.get(i);
        if ("false".equals(fileElement.getAttribute("isDirectory"))) { // $NON-NLS-1$ //$NON-NLS-2$
          String name = fileElement.getAttribute("name"); // $NON-NLS-1$
          String solution = solutionTree.getSolution();
          String path = solutionTree.getPath();
          String lastModifiedDateStr = fileElement.getAttribute("lastModifiedDate"); // $NON-NLS-1$
          String url = fileElement.getAttribute("url"); // $NON-NLS-1$
          ContentTypePlugin plugin = PluginOptionsHelper.getContentTypePlugin(name);
          String icon = null;
          if (plugin != null) {
            icon = plugin.getFileIcon();
          }
          String localizedName = fileElement.getAttribute("localized-name");
          String description = fileElement.getAttribute("description");
          String tooltip = localizedName;
          if (solutionTree.isUseDescriptionsForTooltip() && !StringUtils.isEmpty(description)) {
            tooltip = description;
          }
          final FileItem fileLabel =
              new FileItem(
                  name,
                  localizedName,
                  tooltip,
                  solution,
                  path, //$NON-NLS-1$
                  lastModifiedDateStr,
                  url,
                  this,
                  PluginOptionsHelper.getEnabledOptions(name),
                  toolbar.getSupportsACLs(),
                  icon);
          // BISERVER-2317: Request for more IDs for Mantle UI elements
          // set element id as the filename
          fileLabel.getElement().setId("file-" + name); // $NON-NLS-1$
          fileLabel.addFileSelectionChangedListener(toolbar);
          fileLabel.setWidth("100%"); // $NON-NLS-1$
          try {
            perspective.getDragController().makeDraggable(fileLabel);
          } catch (Exception e) {
            Throwable throwable = e;
            String text = "Uncaught exception: ";
            while (throwable != null) {
              StackTraceElement[] stackTraceElements = throwable.getStackTrace();
              text += throwable.toString() + "\n";
              for (int ii = 0; ii < stackTraceElements.length; ii++) {
                text += "    at " + stackTraceElements[ii] + "\n";
              }
              throwable = throwable.getCause();
              if (throwable != null) {
                text += "Caused by: ";
              }
            }
            DialogBox dialogBox = new DialogBox(true);
            DOM.setStyleAttribute(dialogBox.getElement(), "backgroundColor", "#ABCDEF");
            System.err.print(text);
            text = text.replaceAll(" ", "&nbsp;");
            dialogBox.setHTML("<pre>" + text + "</pre>");
            dialogBox.center();
          }
          filesList.setWidget(rowCounter++, 0, fileLabel);

          if (selectedFileItem != null
              && selectedFileItem.getFullPath().equals(fileLabel.getFullPath())) {
            fileLabel.setStyleName("fileLabelSelected"); // $NON-NLS-1$
            selectedFileItem = fileLabel;
          } else {
            fileLabel.setStyleName("fileLabel"); // $NON-NLS-1$
          }
        }
      }
    }
  }