@Override public boolean performCancel() { // revert changes for (int i = 0; i < fEditSet.size(); i++) { CommentChange change = fEditSet.get(i); ((ApiProblemFilter) change.filter).setComment(change.comment); } fEditSet.clear(); return super.performCancel(); }
/** * Creates a new {@link IApiProblemFilter} * * @param componentid * @param problem * @param comment * @return the new {@link IApiProblemFilter} * @since 1.1 */ public static IApiProblemFilter newProblemFilter(String componentid, IApiProblem problem, String comment) { return new ApiProblemFilter(componentid, problem, comment); }
@Override public boolean equals(Object obj) { if (obj instanceof IApiProblemFilter) { IApiProblemFilter filter = (IApiProblemFilter) obj; return elementsEqual(filter.getComponentId(), fComponentId) && filter.getUnderlyingProblem().equals(fProblem); } else if (obj instanceof IApiProblem) { return fProblem.equals(obj); } return super.equals(obj); }
for (int i = 0; i < comments.size(); i++) { ApiProblemFilter filter = (ApiProblemFilter) comments.get(i); CommentChange change = new CommentChange(filter, filter.getComment()); int idx = fEditSet.indexOf(filter); if(idx < 0) { fEditSet.add(change); filter.setComment(null); refresh = true;
IApiMarkerConstants.MARKER_ATTR_FILTER_HANDLE_ID, IApiMarkerConstants.API_MARKER_ATTR_ID }, new Object[] { ((ApiProblemFilter) filter).getHandle(), Integer.valueOf(IApiMarkerConstants.UNUSED_PROBLEM_FILTER_MARKER_ID) }, lineNumber, charStart, charEnd, problem.getElementKind(), IApiProblem.UNUSED_PROBLEM_FILTERS));
for (int i = 0; i < comments.size(); i++) { ApiProblemFilter filter = (ApiProblemFilter) comments.get(i); CommentChange change = new CommentChange(filter, filter.getComment()); int idx = fEditSet.indexOf(change); if (idx < 0) { fEditSet.add(change); filter.setComment(null); refresh = true;
public boolean performCancel() { //revert changes for (int i = 0; i < fEditSet.size(); i++) { CommentChange change = (CommentChange) fEditSet.get(i); ((ApiProblemFilter)change.filter).setComment(change.comment); } fEditSet.clear(); return super.performCancel(); }
@Override public Object clone() { return new ApiProblemFilter(this.fComponentId, fProblem, fComment); }
/** * Handles the edit button being pressed * * @param selection * @since 1.1 */ void handleEdit(IApiProblemFilter filter) { String orignal = filter.getComment(); String comment = orignal; InputDialog dialog = new InputDialog(getShell(), PropertiesMessages.ApiFiltersPropertyPage_edit_comment, PropertiesMessages.ApiFiltersPropertyPage_edit_filter_comment, comment, null); if (dialog.open() == IDialogConstants.OK_ID) { comment = dialog.getValue(); if (comment != null && comment.length() < 1) { comment = null; } ((ApiProblemFilter) filter).setComment(comment); CommentChange change = new CommentChange(filter, orignal); int idx = fEditSet.indexOf(change); if (idx < 0) { fEditSet.add(change); } fViewer.refresh(filter, true); fViewer.setSelection(fViewer.getSelection(), true); } }
/** * Internal use method that allows auto-persisting of the filter file to be * turned on or off * * @param problems the problems to add the the store * @param persist if the filters should be auto-persisted after they are * added */ @Override protected void internalAddFilters(IApiProblem[] problems, String[] comments) { if (problems == null || problems.length == 0) { return; } // This filter store doesn't handle resources so all filters are added // to GLOBAL Set<IApiProblemFilter> globalFilters = fFilterMap.get(GLOBAL); if (globalFilters == null) { globalFilters = new HashSet<>(); fFilterMap.put(GLOBAL, globalFilters); } for (int i = 0; i < problems.length; i++) { IApiProblem problem = problems[i]; String comment = comments != null ? comments[i] : null; IApiProblemFilter filter = new ApiProblemFilter(fComponentId, problem, comment); globalFilters.add(filter); } }
/** * Handles the edit button being pressed * @param selection * @since 1.1 */ void handleEdit(IApiProblemFilter filter) { String orignal = filter.getComment(); String comment = orignal; InputDialog dialog = new InputDialog(getShell(), PropertiesMessages.ApiFiltersPropertyPage_edit_comment, PropertiesMessages.ApiFiltersPropertyPage_edit_filter_comment, comment, null); if(dialog.open() == IDialogConstants.OK_ID) { comment = dialog.getValue(); if(comment != null && comment.length() < 1) { comment = null; } ((ApiProblemFilter)filter).setComment(comment); CommentChange change = new CommentChange(filter, orignal); int idx = fEditSet.indexOf(change); if(idx < 0) { fEditSet.add(change); } fViewer.refresh(filter, true); fViewer.setSelection(fViewer.getSelection(), true); } }
/** * Internal use method that allows auto-persisting of the filter file to be * turned on or off * * @param problems the problems to add the the store * @param persist if the filters should be auto-persisted after they are * added */ protected void internalAddFilters(IApiProblem[] problems, String[] comments) { if (problems == null || problems.length == 0) { return; } // This filter store doesn't handle resources so all filters are added // to GLOBAL Set<IApiProblemFilter> globalFilters = fFilterMap.get(GLOBAL); if (globalFilters == null) { globalFilters = new HashSet<>(); fFilterMap.put(GLOBAL, globalFilters); } for (int i = 0; i < problems.length; i++) { IApiProblem problem = problems[i]; String comment = comments != null ? comments[i] : null; IApiProblemFilter filter = new ApiProblemFilter(fComponent.getSymbolicName(), problem, comment); globalFilters.add(filter); } }
for (int i = 0; i < problems.length; i++) { IApiProblem problem = problems[i]; IApiProblemFilter filter = new ApiProblemFilter(fProject.getElementName(), problem, (comments == null ? null : comments[i])); String resourcePath = problem.getResourcePath(); if (resourcePath == null) {