### Eclipse Workspace Patch 1.0 #P org.eclipse.mylyn.bugzilla.ui Index: src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java =================================================================== RCS file: /cvsroot/mylyn/org.eclipse.mylyn.tasks/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java,v retrieving revision 1.150 diff -u -r1.150 BugzillaSearchPage.java --- src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 26 Dec 2010 18:23:44 -0000 1.150 +++ src/org/eclipse/mylyn/internal/bugzilla/ui/search/BugzillaSearchPage.java 2 Feb 2011 19:59:22 -0000 @@ -23,6 +23,8 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -45,6 +47,7 @@ import org.eclipse.jface.window.Window; import org.eclipse.mylyn.commons.core.CoreUtil; import org.eclipse.mylyn.commons.core.StatusHandler; +import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCustomField; import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector; import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants; import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; @@ -149,9 +152,155 @@ private static final String[] emailRoleValues2 = { "emailassigned_to2", "emailreporter2", "emailcc2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ "emaillongdesc2", "emailqa_contact2" }; //$NON-NLS-1$ //$NON-NLS-2$ + private static final ArrayList chartFieldTextDefault = new ArrayList() { + private static final long serialVersionUID = 1974092160992399001L; + { + add(Messages.BugzillaSearchPage_Field_Noop); + add(Messages.BugzillaSearchPage_Field_Alias); + add(Messages.BugzillaSearchPage_Field_AssignedTo); + add(Messages.BugzillaSearchPage_Field_Attachment_creator); + add(Messages.BugzillaSearchPage_Field_Attachment_data); + add(Messages.BugzillaSearchPage_Field_Attachment_description); + add(Messages.BugzillaSearchPage_Field_Attachment_filename); + add(Messages.BugzillaSearchPage_Field_Attachment_is_a_URL); + add(Messages.BugzillaSearchPage_Field_Attachment_is_obsolete); + add(Messages.BugzillaSearchPage_Field_Attachment_is_patch); + add(Messages.BugzillaSearchPage_Field_Attachment_is_private); + add(Messages.BugzillaSearchPage_Field_Attachment_mime_type); + add(Messages.BugzillaSearchPage_Field_Blocks); + add(Messages.BugzillaSearchPage_Field_Bug); + add(Messages.BugzillaSearchPage_Field_CC); + add(Messages.BugzillaSearchPage_Field_CC_Accessible); + add(Messages.BugzillaSearchPage_Field_Classification); + add(Messages.BugzillaSearchPage_Field_Comment); + add(Messages.BugzillaSearchPage_Field_Comment_is_private); + add(Messages.BugzillaSearchPage_Field_Commenter); + add(Messages.BugzillaSearchPage_Field_Component); + add(Messages.BugzillaSearchPage_Field_Content); + add(Messages.BugzillaSearchPage_Field_Creation_date); + add(Messages.BugzillaSearchPage_Field_Days_since_bug_changed); + add(Messages.BugzillaSearchPage_Field_Depends_on); + add(Messages.BugzillaSearchPage_Field_drop_down_custom_field); + add(Messages.BugzillaSearchPage_Field_Ever_Confirmed); + add(Messages.BugzillaSearchPage_Field_Flag); + add(Messages.BugzillaSearchPage_Field_Flag_Requestee); + add(Messages.BugzillaSearchPage_Field_Flag_Setter); + add(Messages.BugzillaSearchPage_Field_free_text_custom_field); + add(Messages.BugzillaSearchPage_Field_Group); + add(Messages.BugzillaSearchPage_Field_Keywords); + add(Messages.BugzillaSearchPage_Field_Last_changed_date); + add(Messages.BugzillaSearchPage_Field_OS_Version); + add(Messages.BugzillaSearchPage_Field_Platform); + add(Messages.BugzillaSearchPage_Field_Priority); + add(Messages.BugzillaSearchPage_Field_Product); + add(Messages.BugzillaSearchPage_Field_QAContact); + add(Messages.BugzillaSearchPage_Field_ReportedBy); + add(Messages.BugzillaSearchPage_Field_Reporter_Accessible); + add(Messages.BugzillaSearchPage_Field_Resolution); + add(Messages.BugzillaSearchPage_Field_Severity); + add(Messages.BugzillaSearchPage_Field_Status); + add(Messages.BugzillaSearchPage_Field_Status_Whiteboard); + add(Messages.BugzillaSearchPage_Field_Summary); + add(Messages.BugzillaSearchPage_Field_Target_Milestone); + add(Messages.BugzillaSearchPage_Field_Time_Since_Assignee_Touched); + add(Messages.BugzillaSearchPage_Field_URL); + add(Messages.BugzillaSearchPage_Field_Version); + add(Messages.BugzillaSearchPage_Field_Votes); + } + }; + + private static final ArrayList chartFieldValuesDefault = new ArrayList() { + private static final long serialVersionUID = 9135403539678279982L; + { + add("noop"); //$NON-NLS-1$ + add("alias"); //$NON-NLS-1$ + add("assigned_to"); //$NON-NLS-1$ + add("attachments.submitter"); //$NON-NLS-1$ + add("attach_data.thedata"); //$NON-NLS-1$ + add("attachments.description"); //$NON-NLS-1$ + add("attachments.filename"); //$NON-NLS-1$ + add("attachments.isurl"); //$NON-NLS-1$ + add("attachments.isobsolete"); //$NON-NLS-1$ + add("attachments.ispatch"); //$NON-NLS-1$ + add("attachments.isprivate"); //$NON-NLS-1$ + add("attachments.mimetype"); //$NON-NLS-1$ + add("blocked"); //$NON-NLS-1$ + add("bug_id"); //$NON-NLS-1$ + add("cc"); //$NON-NLS-1$ + add("cclist_accessible"); //$NON-NLS-1$ + add("classification"); //$NON-NLS-1$ + add("longdesc"); //$NON-NLS-1$ + add("longdescs.isprivate"); //$NON-NLS-1$ + add("commenter"); //$NON-NLS-1$ + add("component"); //$NON-NLS-1$ + add("content"); //$NON-NLS-1$ + add("creation_ts"); //$NON-NLS-1$ + add("days_elapsed"); //$NON-NLS-1$ + add("dependson"); //$NON-NLS-1$ + add("cf_dropdown"); //$NON-NLS-1$ + add("everconfirmed"); //$NON-NLS-1$ + add("flagtypes.name"); //$NON-NLS-1$ + add("requestees.login_name"); //$NON-NLS-1$ + add("setters.login_name"); //$NON-NLS-1$ + add("cf_freetext"); //$NON-NLS-1$ + add("bug_group"); //$NON-NLS-1$ + add("keywords"); //$NON-NLS-1$ + add("delta_ts"); //$NON-NLS-1$ + add("op_sys"); //$NON-NLS-1$ + add("rep_platform"); //$NON-NLS-1$ + add("priority"); //$NON-NLS-1$ + add("product"); //$NON-NLS-1$ + add("qa_contact"); //$NON-NLS-1$ + add("reporter"); //$NON-NLS-1$ + add("reporter_accessible"); //$NON-NLS-1$ + add("resolution"); //$NON-NLS-1$ + add("bug_severity"); //$NON-NLS-1$ + add("bug_status"); //$NON-NLS-1$ + add("status_whiteboard"); //$NON-NLS-1$ + add("short_desc"); //$NON-NLS-1$ + add("target_milestone"); //$NON-NLS-1$ + add("owner_idle_time"); //$NON-NLS-1$ + add("bug_file_loc"); //$NON-NLS-1$ + add("version"); //$NON-NLS-1$ + add("votes"); //$NON-NLS-1$ + } + }; + + private static final String[] chartOperationText = { Messages.BugzillaSearchPage_Operation_Noop, + Messages.BugzillaSearchPage_Operation_is_equal_to, Messages.BugzillaSearchPage_Operation_is_not_equal_to, + Messages.BugzillaSearchPage_Operation_is_equal_to_any_of_the_strings, + Messages.BugzillaSearchPage_Operation_contains_the_string, + Messages.BugzillaSearchPage_Operation_contains_the_string_exact_case, + Messages.BugzillaSearchPage_Operation_does_not_contain_the_string, + Messages.BugzillaSearchPage_Operation_contains_any_of_the_strings, + Messages.BugzillaSearchPage_Operation_contains_all_of_the_strings, + Messages.BugzillaSearchPage_Operation_contains_none_of_the_strings, + Messages.BugzillaSearchPage_Operation_contains_regexp, + Messages.BugzillaSearchPage_Operation_does_not_contain_regexp, + Messages.BugzillaSearchPage_Operation_is_less_than, Messages.BugzillaSearchPage_Operation_is_greater_than, + Messages.BugzillaSearchPage_Operation_contains_any_of_he_words, + Messages.BugzillaSearchPage_Operation_contains_all_of_the_words, + Messages.BugzillaSearchPage_Operation_contains_none_of_the_words, + Messages.BugzillaSearchPage_Operation_changed_before, Messages.BugzillaSearchPage_Operation_changed_after, + Messages.BugzillaSearchPage_Operation_changed_from, Messages.BugzillaSearchPage_Operation_changed_to, + Messages.BugzillaSearchPage_Operation_changed_by, Messages.BugzillaSearchPage_Operation_matches }; + + private static final String[] chartOperationValues = { "noop", "equals", "notequals", "anyexact", "substring", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "casesubstring", "notsubstring", "anywordssubstr", "allwordssubstr", "nowordssubstr", "regexp", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + "notregexp", "lessthan", "greaterthan", "anywords", "allwords", "nowords", "changedbefore", "changedafter", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ + "changedfrom", "changedto", "changedby", "matches" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + // dialog store id constants private final static String DIALOG_BOUNDS_KEY = "ResizableDialogBounds"; //$NON-NLS-1$ + private final static String REGEXP_CHART_EXPR = "(field|type|value)([0-9]+)-([0-9]+)-([0-9]+)"; //$NON-NLS-1$ + + private static final Pattern PATTERN_CHART_EXPR = Pattern.compile(REGEXP_CHART_EXPR, Pattern.CASE_INSENSITIVE); + + private final static String REGEXP_CHART_NEGATE = "(negate)([0-9]+)"; //$NON-NLS-1$ + + private static final Pattern PATTERN_CHART_NEGATE = Pattern.compile(REGEXP_CHART_NEGATE, Pattern.CASE_INSENSITIVE); + private static final String X = "x"; //$NON-NLS-1$ private static final String Y = "y"; //$NON-NLS-1$ @@ -216,6 +365,10 @@ protected Text daysText; + protected String[] chartFieldText; + + protected String[] chartFieldValues; + // /** File containing saved queries */ // protected static SavedQueryFile input; @@ -292,6 +445,183 @@ private ExpandableComposite moreOptionsExpandComposite; +//FB private ExpandableComposite basicOptionsExpandComposite; + + private ExpandableComposite chartExpandComposite; + +// private Group chartGroup; + private Composite chartGroup; + + protected class ChartExpression { + private int fieldName; + + private int operation; + + private String value; + + public ChartExpression(int fieldName, int operation, String value) { + super(); + this.fieldName = fieldName; + this.operation = operation; + this.value = value; + } + + public int getFieldName() { + return fieldName; + } + + public void setFieldName(int fieldName) { + this.fieldName = fieldName; + } + + public int getOperation() { + return operation; + } + + public void setOperation(int operation) { + this.operation = operation; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + + protected class Chart { + private final ArrayList> expressions; + + private boolean negate; + + public Chart() { + super(); + ChartExpression expression = new ChartExpression(0, 0, ""); //$NON-NLS-1$ + ArrayList column = new ArrayList(1); + column.add(expression); + expressions = new ArrayList>(1); + expressions.add(column); + negate = false; + } + + public boolean isNegate() { + return negate; + } + + public void setNegate(boolean negate) { + this.negate = negate; + } + + public void addExpression(int rowIndex, int columnIndex) { + ChartExpression expression = new ChartExpression(0, 0, ""); //$NON-NLS-1$ + int size = expressions.size(); + if (rowIndex > size + 1) { + rowIndex = size + 1; + } + if (rowIndex < 0) { + rowIndex = 0; + } + ArrayList row; + if (rowIndex == size) { + row = new ArrayList(); + expressions.add(rowIndex, row); + } else { + row = expressions.get(rowIndex); + } + if (row != null) { + int size1 = expressions.size(); + if (columnIndex > size1 + 1) { + columnIndex = size1 + 1; + } + if (columnIndex < 0) { + columnIndex = 0; + } + row.add(columnIndex, expression); + } + + } + + public void addRow(int index) { + int size = expressions.size(); + if (index > size) { + index = size; + } + if (index < 0) { + index = 0; + } + addRow(index); + } + + public int getRowSize() { + return expressions.size(); + } + + public int getColumnSize(int row) { + int size = expressions.size(); + if (row > size) { + row = size; + } + if (row < 0) { + row = 0; + } + return expressions.get(row).size(); + } + + public ChartExpression getChartExpression(int row, int column) { + int rowSize = expressions.size(); + if (row > rowSize) { + row = rowSize; + } + if (row < 0) { + row = 0; + } + + int columnSize = getColumnSize(row); + if (column > columnSize) { + column = columnSize; + } + if (column < 0) { + column = 0; + } + return expressions.get(row).get(column); + } + } + + private final ArrayList charts = new ArrayList(1); + + private class ChartControls { + private final Combo field; + + private final Combo operation; + + private final Combo value; + + public ChartControls(Combo field, Combo operation, Combo value) { + super(); + this.field = field; + this.operation = operation; + this.value = value; + } + + public Combo getField() { + return field; + } + + public Combo getOperation() { + return operation; + } + + public Combo getValue() { + return value; + } + } + + private final ArrayList>> chartControls = new ArrayList>>(); + + private final ArrayList