Пример #1
0
 public String[] getNames(boolean checkBoxState) {
   final ArrayList<String> result = new ArrayList<String>();
   collectActionIds(
       result, (ActionGroup) myActionManager.getActionOrStub(IdeActions.GROUP_MAIN_MENU));
   if (checkBoxState) {
     final Set<String> ids = ((ActionManagerImpl) myActionManager).getActionIds();
     for (String id : ids) {
       final AnAction anAction = myActionManager.getAction(id);
       if (!(anAction instanceof ActionGroup)) {
         result.add(id);
       }
     }
   }
   return ArrayUtil.toStringArray(result);
 }
Пример #2
0
 /** Parse a string of the form [x1,y1},[x2,y2},...,[xN,yN} into a list of Points ([int,int]) */
 public static List<Point> parseString(String str) throws NumberFormatException {
   if (StringUtil.isNullString(str)) {
     throw new IllegalArgumentException("Must supply non-empty string");
   }
   ArrayList<Point> res = new ArrayList<Point>();
   Perl5Matcher matcher = RegexpUtil.getMatcher();
   while (matcher.contains(str, ONE_POINT_PAT)) {
     MatchResult matchResult = matcher.getMatch();
     String xstr = matchResult.group(1);
     String ystr = matchResult.group(2);
     str = matchResult.group(3);
     try {
       int x = Integer.parseInt(xstr);
       int y = Integer.parseInt(ystr);
       res.add(new Point(x, y));
     } catch (NumberFormatException e) {
       throw new IllegalArgumentException("bad point [" + xstr + "," + ystr + "] in " + str);
     }
   }
   res.trimToSize();
   return res;
 }
  /**
   * Filters a collection according to the include and exclude parameters.
   *
   * @param c The collection to filter.
   * @return A filtered collection.
   */
  protected Collection filterCollection(Collection c) {
    ArrayList<Object> result = new ArrayList<Object>();

    PatternMatcher pm = new Perl5Matcher();

    for (Iterator i = c.iterator(); i.hasNext(); ) {
      String pageName = null;
      Object objectje = i.next();
      if (objectje instanceof WikiPage) {
        pageName = ((WikiPage) objectje).getName();
      } else {
        pageName = (String) objectje;
      }

      //
      //  If include parameter exists, then by default we include only those
      //  pages in it (excluding the ones in the exclude pattern list).
      //
      //  include='*' means the same as no include.
      //
      boolean includeThis = m_include == null;

      if (m_include != null) {
        for (int j = 0; j < m_include.length; j++) {
          if (pm.matches(pageName, m_include[j])) {
            includeThis = true;
            break;
          }
        }
      }

      if (m_exclude != null) {
        for (int j = 0; j < m_exclude.length; j++) {
          if (pm.matches(pageName, m_exclude[j])) {
            includeThis = false;
            break; // The inner loop, continue on the next item
          }
        }
      }

      if (includeThis) {
        if (objectje instanceof WikiPage) {
          result.add(objectje);
        } else {
          result.add(pageName);
        }
        //
        //  if we want to show the last modified date of the most recently change page, we keep a
        // "high watermark" here:
        WikiPage page = null;
        if (m_lastModified) {
          page = m_engine.getPage(pageName);
          if (page != null) {
            Date lastModPage = page.getLastModified();
            if (log.isDebugEnabled()) {
              log.debug("lastModified Date of page " + pageName + " : " + m_dateLastModified);
            }
            if (lastModPage.after(m_dateLastModified)) {
              m_dateLastModified = lastModPage;
            }
          }
        }
      }
    }

    return result;
  }
Пример #4
0
  static {
    errs.add(
        new SolutionMessage(
            PARSER,
            // This error message indicates a stray XML escape character
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="The content of elements must consist of well-formed character data or markup"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-101"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Look for stray or unmatched XML escape chars ( <, >, or & ) in your source code. When using '<' in a Script, XML requires wrapping the Script content with '<![CDATA[' and ']]>'. "
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-108")));

    errs.add(
        new SolutionMessage(
            PARSER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="entity name must immediately follow the '&' in the entity reference"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-117"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Look for unescaped '&' characters in your source code."
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-124")));

    errs.add(
        new SolutionMessage(
            VIEWCOMPILER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Was expecting one of: instanceof"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-133"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="The element and attribute names in .lzx files are case-sensitive; Look for a mistake in the upper/lower case spelling of attribute names, i.e., \"onClick\" instead of \"onclick\""
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-140")));

    errs.add(
        new SolutionMessage(
            PARSER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="\"\" is not a valid local name"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-150"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Make sure that every <class> and <attribute> tag element contains a non-empty 'name' attribute, and each <method> element contains a non-empty 'name' or 'event' attribute."
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-157")));

    errs.add(
        new SolutionMessage(
            PARSER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="The root element is required in a well-formed document"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-166"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Check for invalid UTF8 characters in your source file. LZX XML files may contain only legal UTF-8 character codes. If you see a character with an accent over it, it might be the problem."
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-173")));

    errs.add(
        new SolutionMessage(
            PARSER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Content is not allowed in prolog"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-182"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Some text editors may insert a Byte-Order Mark (the sequence of characters 0xEFBBBF) at the start of your source file without your knowledge. Please remove any non-whitespace characters before the start of the first '<' character."
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-189")));

    errs.add(
        new SolutionMessage(
            PARSER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="The reference to entity.*must end with the"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-198"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Look for a misplaced or unescaped ampersand ('&') character in your source code."
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-205")));

    errs.add(
        new SolutionMessage(
            VIEWCOMPILER,
            "unable to build font",
            "The font may be a bold or italic style, try adding style=\"bold\" or \"italic\" attribute to font tag"));

    errs.add(
        new SolutionMessage(
            VIEWCOMPILER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Lexical error.  The source location is for the element that contains the erroneous script"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-215"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Examine the compiler warnings for warnings about undefined class or attribute names."
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-222")));

    errs.add(
        new SolutionMessage(
            PARSER,
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Error in building"
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-231"),
            /* (non-Javadoc)
             * @i18n.test
             * @org-mes="Check for invalid UTF8 characters in your source file. LZX XML files may contain only legal UTF-8 character codes. If you see a character with an accent over it, it might be the problem."
             */
            org.openlaszlo.i18n.LaszloMessages.getMessage(
                SolutionMessages.class.getName(), "051018-238")));
  }