コード例 #1
0
 @Override
 public final void restoreSettings() {
   int type = GuiSettings.getShowFilenameInWindowTitle();
   if (type >= GuiSettings.SHOW_NO_FILENAME && type <= GuiSettings.SHOW_FULL_PATH) {
     this.windowTitleComboBox.setSelectedIndex(type);
   }
   this.showProfileGroup.setSelected(GuiSettings.getShowProfileGroupInWindowTitle());
   this.showWorkspace.setSelected(GuiSettings.getShowWorkspaceInWindowTitle());
   this.productAtEnd.setSelected(GuiSettings.getShowProductNameAtEnd());
   this.showUrl.setSelected(GuiSettings.getShowURLinWindowTitle());
   this.includeUser.setSelected(GuiSettings.getIncludeUserInTitleURL());
   this.includeUser.setEnabled(showUrl.isSelected());
   String enclose = GuiSettings.getTitleGroupBracket();
   if (enclose == null) {
     encloseChar.setSelectedIndex(0);
   } else {
     int count = encloseChar.getItemCount();
     for (int i = 1; i < count; i++) {
       String item = (String) encloseChar.getItemAt(i);
       if (item.startsWith(enclose.trim())) {
         encloseChar.setSelectedIndex(i);
         break;
       }
     }
   }
   checkShowProfile();
   this.titleGroupSep.setText(GuiSettings.getTitleGroupSeparator());
 }
コード例 #2
0
  public String getWindowTitle(
      ConnectionProfile profile, String workspaceFile, String editorFile, String appName) {
    final StringBuilder title = new StringBuilder(50);

    String enclose = GuiSettings.getTitleGroupBracket();
    String sep = GuiSettings.getTitleGroupSeparator();

    if (appName != null && productNamePosition == NAME_AT_START) {
      title.append(appName);
      title.append(' ');
    }

    if (profile != null) {
      boolean showUser = includeUser || profile.getPromptForUsername();

      if (showURL) {
        String url = makeCleanUrl(profile.getUrl());
        if (showUser) {
          title.append(profile.getLoginUser());
          if (url.charAt(0) != '@') {
            title.append('@');
          }
        }
        title.append(url);
      } else {
        if (profile.getPromptForUsername()) {
          // always display the username if prompted
          title.append(profile.getLoginUser());
          title.append("- ");
        }
        if (showProfileGroup) {
          char open = getOpeningBracket(enclose);
          char close = getClosingBracket(enclose);

          if (open != 0 && close != 0) {
            title.append(open);
          }
          title.append(profile.getGroup());
          if (open != 0 && close != 0) {
            title.append(close);
          }
          if (sep != null) title.append(sep);
        }
        title.append(profile.getName());
      }
    } else if (showNotConnected) {
      if (title.length() > 0) title.append("- ");
      title.append(ResourceMgr.getString("TxtNotConnected"));
    }

    if (workspaceFile != null && showWorkspace) {
      File f = new File(workspaceFile);
      String baseName = f.getName();
      title.append(" - ");
      title.append(baseName);
      title.append(" ");
    }

    int showFilename = GuiSettings.getShowFilenameInWindowTitle();
    if (editorFile != null && showFilename != GuiSettings.SHOW_NO_FILENAME) {
      title.append(" - ");
      if (showFilename == GuiSettings.SHOW_FULL_PATH) {
        title.append(editorFile);
      } else {
        File f = new File(editorFile);
        title.append(f.getName());
      }
    }

    if (appName != null && productNamePosition == NAME_AT_END) {
      if (title.length() > 0) title.append(" - ");
      title.append(appName);
    }

    return title.toString();
  }