示例#1
0
 /** @return */
 private TopicContextService findService() {
   IViewer viewer = topicPart.getSite().getViewer();
   if (viewer != null) {
     return (TopicContextService) viewer.getService(TopicContextService.class);
   }
   return null;
 }
示例#2
0
 public static String getIndexedBranchLineColor(IBranchPart branch) {
   IBranchPart parent = branch.getParentBranch();
   if (parent != null) {
     int index = parent.getSubBranches().indexOf(branch);
     if (index >= 0) {
       IStyleSelector parentSS = StyleUtils.getStyleSelector(parent);
       String value = parentSS.getUserValue(parent, Styles.MultiLineColors);
       ISheetPart sheet = null;
       if (value == null) {
         // compatible with former versions:
         IViewer viewer = parent.getSite().getViewer();
         if (viewer != null) {
           sheet = (ISheetPart) viewer.getAdapter(ISheetPart.class);
           if (sheet != null) {
             value =
                 StyleUtils.getStyleSelector(sheet).getUserValue(sheet, Styles.MultiLineColors);
           }
         }
       }
       if (value == null) {
         value = parentSS.getStyleValue(parent, Styles.MultiLineColors);
       }
       //                if (value == null && sheet != null) {
       //                    value = StyleUtils.getStyleSelector(sheet).getStyleValue(
       //                            sheet, Styles.MultiLineColors);
       //                }
       if (value != null) {
         if (!Styles.NONE.equals(value)) {
           value = value.trim();
           // split by whitespaces
           String[] colors = value.split("[\\s]+"); // $NON-NLS-1$
           if (colors.length > 0) {
             index %= colors.length;
             String color = colors[index].trim();
             return color;
           }
         }
       }
       return null;
     }
   }
   return null;
 }
示例#3
0
 public static boolean isBranchLineTapered(IBranchPart branch, IStyleSelector ss) {
   if (branch != null && ss != null && branch.isCentral()) {
     String value = ss.getUserValue(branch, Styles.LineTapered);
     if (value == null) {
       // compatible with former versions:
       IViewer viewer = branch.getSite().getViewer();
       if (viewer != null) {
         ISheetPart sheet = (ISheetPart) viewer.getAdapter(ISheetPart.class);
         if (sheet != null) {
           value = getStyleSelector(sheet).getUserValue(sheet, Styles.LineTapered);
         }
       }
     }
     if (value == null) {
       value = ss.getStyleValue(branch, Styles.LineTapered);
     }
     return value != null && value.contains(Styles.TAPERED);
   }
   return false;
 }