rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
return access.getDefaultPersonalAccess().toCharArray(); | return Access.getDefaultPersonalAccess().toCharArray(); | private char[] getAclChars(BwShareableDbentity ent) throws CalFacadeException { if (ent instanceof BwShareableContainedDbentity) { BwCalendar container; if (ent instanceof BwCalendar) { container = (BwCalendar)ent; } else { container = ((BwShareableContainedDbentity)ent).getCalendar(); } String path = container.getPath(); PathInfo pi = pathInfoMap.getInfo(path); if (pi == null) { pi = getPathInfo(container); pathInfoMap.putInfo(path, pi); } char[] aclChars = pi.encoded; if (ent instanceof BwCalendar) { return aclChars; } /* Create a merged access string from the entity access and the * container access */ String entAccess = ent.getAccess(); /* if (entAccess == null) { // Nomerge needed return aclChars; } */ try { Acl acl = new Acl(); if (entAccess != null) { acl.decode(entAccess.toCharArray()); } acl.merge(aclChars); return acl.encodeAll(); } catch (Throwable t) { throw new CalFacadeException(t); } } /* This is a way of making other objects sort of shareable. * The objects are locations, sponsors and categories. * * We store the default access in the owner principal and manipulate that to give * us some degree of sharing. * * In effect, the owner becomes the container for the object. */ String aclString = null; String entAccess = ent.getAccess(); BwUser owner = ent.getOwner(); if (ent instanceof BwCategory) { aclString = owner.getCategoryAccess(); } else if (ent instanceof BwLocation) { aclString = owner.getLocationAccess(); } else if (ent instanceof BwSponsor) { aclString = owner.getSponsorAccess(); } if (aclString == null) { if (entAccess == null) { if (ent.getPublick()) { return access.getDefaultPublicAccess().toCharArray(); } return access.getDefaultPersonalAccess().toCharArray(); } return entAccess.toCharArray(); } if (entAccess == null) { return aclString.toCharArray(); } try { Acl acl = new Acl(); acl.decode(entAccess.toCharArray()); acl.merge(aclString.toCharArray()); return acl.getEncoded(); } catch (Throwable t) { throw new CalFacadeException(t); } } |
return access.getDefaultPersonalAccess(); | return Access.getDefaultPersonalAccess(); | public String getDefaultPersonalAccess() { return access.getDefaultPersonalAccess(); } |
return access.getDefaultPublicAccess(); | return Access.getDefaultPublicAccess(); | public String getDefaultPublicAccess() { return access.getDefaultPublicAccess(); } |
try { return dt1.getDate().compareTo(dt2.getDate()); } catch (CalFacadeException cfe) { throw new RuntimeException(cfe); } | return dt1.getDate().compareTo(dt2.getDate()); | public int compare(Object o1, Object o2) { if (o1 == o2) { return 0; } if (!(o1 instanceof BwDateTime)) { return -1; } if (!(o2 instanceof BwDateTime)) { return 1; } BwDateTime dt1 = (BwDateTime)o1; BwDateTime dt2 = (BwDateTime)o2; try { return dt1.getDate().compareTo(dt2.getDate()); } catch (CalFacadeException cfe) { throw new RuntimeException(cfe); } } |
public String getDate() throws CalFacadeException { | public String getDate() { | public String getDate() throws CalFacadeException { return date; } |
doAuth(cardnumber, monthExpires, yearExpires, Double.parseDouble(amount) / (double) amountMultiplier, currency, "5", null, authIDRsp); | doAuth(cardnumber, monthExpires, yearExpires, Double.parseDouble(amount) / (double) amountMultiplier, currency, "1", null, authIDRsp); | public void finishTransaction(String properties) throws CreditCardAuthorizationException { HashMap map = parseProperties(properties); String cardnumber = (String) map.get(TPOS3Client.PN_PAN); String expires = (String) map.get(TPOS3Client.PN_EXPIRE); String amount = (String) map.get(TPOS3Client.PN_AMOUNT); String currency = (String) map.get(TPOS3Client.PN_CURRENCY); String monthExpires = expires.substring(0, 2); String yearExpires = expires.substring(2, 4); String authIDRsp = (String) map.get(TPOS3Client.PN_AUTHORIDENTIFYRSP); doAuth(cardnumber, monthExpires, yearExpires, Double.parseDouble(amount) / (double) amountMultiplier, currency, "5", null, authIDRsp); } |
System.out.println(nameOfReport); System.out.println(TextSoap.encodeToValidExcelSheetName(nameOfReport)); System.out.println(nameOfReport); | public void writeSimpleExcelFile(JRDataSource reportData, String nameOfReport, String filePathAndName, ReportDescription description) throws IOException{ if(nameOfReport==null || "".equals(nameOfReport)){ nameOfReport = "Report"; } System.out.println(nameOfReport); System.out.println(TextSoap.encodeToValidExcelSheetName(nameOfReport)); System.out.println(nameOfReport); HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = sheet = wb.createSheet(TextSoap.encodeToValidExcelSheetName(nameOfReport)); int rowIndex = 0; //-- Report Name --// // Create a row and put some cells in it. Rows are 0 based. HSSFRow row = sheet.createRow((short)rowIndex++); // Create a cell and put a value in it. HSSFCell cell = row.createCell((short)0); // Create a new font and alter it. HSSFFont font = wb.createFont(); font.setFontHeightInPoints((short)24); font.setFontName("Courier New"); font.setItalic(true); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // Fonts are set into a style so create a new one to use. HSSFCellStyle style = wb.createCellStyle(); style.setFont(font); // Create a cell and put a value in it. cell.setCellValue(nameOfReport); cell.setCellStyle(style); //-- Report Parameters --// rowIndex++; HSSFRow row1 = null; String parameterString = ""; List labels = description.getListOfHeaderParameterLabelKeys(); List parameters = description.getListOfHeaderParameterKeys(); Iterator labelIter = labels.iterator(); Iterator parameterIter = parameters.iterator(); boolean newLineForeEachParameter = description.doCreateNewLineForEachParameter(); while (labelIter.hasNext() && parameterIter.hasNext()) { String label = description.getParameterOrLabelName((String)labelIter.next()); String parameter = description.getParameterOrLabelName((String)parameterIter.next()); if(newLineForeEachParameter){ row1 = sheet.createRow((short)rowIndex++); row1.createCell((short)0).setCellValue(label + " "+parameter); } else { parameterString += label + " "+parameter+" "; } } if(!newLineForeEachParameter){ row1 = sheet.createRow((short)rowIndex++); row1.createCell((short)0).setCellValue(parameterString); } rowIndex++; //-- Report ColumnHeader --// List fields = description.getListOfFields(); HSSFRow headerRow = sheet.createRow((short)rowIndex++); HSSFCellStyle headerCellStyle = wb.createCellStyle(); headerCellStyle.setWrapText( true ); headerCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP); headerCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); HSSFFont headerCellFont = wb.createFont(); //headerCellFont.setFontHeightInPoints((short)12); headerCellFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); headerCellStyle.setFont(headerCellFont); int colIndex = 0; int columnWithUnit = 256; // the unit is 1/256 of a character int numberOfCharactersPerLineInLongTextFields = 60; int numberOfCharactersPerLineInRatherLongTextFields = 35; int numberOfCharactersPerLineInUndifinedTextFields = 20; for (Iterator iter = fields.iterator(); iter.hasNext();colIndex++) { ReportableField field = (ReportableField) iter.next(); HSSFCell headerCell = headerRow.createCell((short)colIndex); headerCell.setCellValue((String)description.getColumnName(field)); headerCell.setCellStyle(headerCellStyle); //column width int fieldsMaxChar = field.getMaxNumberOfCharacters(); int colWith = numberOfCharactersPerLineInRatherLongTextFields*columnWithUnit; //default, can be rather long text if(fieldsMaxChar > 0 && fieldsMaxChar < numberOfCharactersPerLineInRatherLongTextFields){ colWith = (fieldsMaxChar+1)*columnWithUnit; // short fields } else if(fieldsMaxChar > 500){ // when the field is set to be able to contain very long text colWith = numberOfCharactersPerLineInLongTextFields*columnWithUnit; //can be very long text } else if(fieldsMaxChar < 0){ colWith = numberOfCharactersPerLineInUndifinedTextFields*columnWithUnit; } sheet.setColumnWidth((short)colIndex,(short)colWith); } //-- Report ColumnDetail --// try { HSSFCellStyle dataCellStyle = wb.createCellStyle(); dataCellStyle.setWrapText( true ); dataCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP); sheet.createFreezePane( 0, rowIndex ); while(reportData.next()){ HSSFRow dataRow = sheet.createRow((short)rowIndex++); colIndex = 0; for (Iterator iter = fields.iterator(); iter.hasNext();colIndex++) { ReportableField field = (ReportableField) iter.next(); HSSFCell dataCell = dataRow.createCell((short)colIndex); Object fieldValue = reportData.getFieldValue(field); if(fieldValue != null){ dataCell.setCellValue(String.valueOf(fieldValue)); } dataCell.setCellStyle(dataCellStyle); } } } catch (JRException e) { //-- Exception fetching data --// HSSFRow exceptionRow = sheet.createRow((short)rowIndex++); HSSFCell exceptionCell = exceptionRow.createCell((short)0); // Create a new font and alter it. HSSFFont exceptionFont = wb.createFont(); exceptionFont.setFontName("Courier New"); exceptionFont.setItalic(true); // Fonts are set into a style so create a new one to use. HSSFCellStyle exceptionStyle = wb.createCellStyle(); exceptionStyle.setFont(exceptionFont); // Create a cell and put a value in it. exceptionCell.setCellValue("Error occurred while getting data. Check log for more details."); exceptionCell.setCellStyle(exceptionStyle); e.printStackTrace(); } // Write the output to a file FileOutputStream fileOut = new FileOutputStream(filePathAndName); wb.write(fileOut); fileOut.close(); } |
|
HSSFSheet sheet = sheet = wb.createSheet(TextSoap.encodeToValidExcelSheetName(nameOfReport)); | HSSFSheet sheet = wb.createSheet(TextSoap.encodeToValidExcelSheetName(nameOfReport)); | public void writeSimpleExcelFile(JRDataSource reportData, String nameOfReport, String filePathAndName, ReportDescription description) throws IOException{ if(nameOfReport==null || "".equals(nameOfReport)){ nameOfReport = "Report"; } System.out.println(nameOfReport); System.out.println(TextSoap.encodeToValidExcelSheetName(nameOfReport)); System.out.println(nameOfReport); HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = sheet = wb.createSheet(TextSoap.encodeToValidExcelSheetName(nameOfReport)); int rowIndex = 0; //-- Report Name --// // Create a row and put some cells in it. Rows are 0 based. HSSFRow row = sheet.createRow((short)rowIndex++); // Create a cell and put a value in it. HSSFCell cell = row.createCell((short)0); // Create a new font and alter it. HSSFFont font = wb.createFont(); font.setFontHeightInPoints((short)24); font.setFontName("Courier New"); font.setItalic(true); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // Fonts are set into a style so create a new one to use. HSSFCellStyle style = wb.createCellStyle(); style.setFont(font); // Create a cell and put a value in it. cell.setCellValue(nameOfReport); cell.setCellStyle(style); //-- Report Parameters --// rowIndex++; HSSFRow row1 = null; String parameterString = ""; List labels = description.getListOfHeaderParameterLabelKeys(); List parameters = description.getListOfHeaderParameterKeys(); Iterator labelIter = labels.iterator(); Iterator parameterIter = parameters.iterator(); boolean newLineForeEachParameter = description.doCreateNewLineForEachParameter(); while (labelIter.hasNext() && parameterIter.hasNext()) { String label = description.getParameterOrLabelName((String)labelIter.next()); String parameter = description.getParameterOrLabelName((String)parameterIter.next()); if(newLineForeEachParameter){ row1 = sheet.createRow((short)rowIndex++); row1.createCell((short)0).setCellValue(label + " "+parameter); } else { parameterString += label + " "+parameter+" "; } } if(!newLineForeEachParameter){ row1 = sheet.createRow((short)rowIndex++); row1.createCell((short)0).setCellValue(parameterString); } rowIndex++; //-- Report ColumnHeader --// List fields = description.getListOfFields(); HSSFRow headerRow = sheet.createRow((short)rowIndex++); HSSFCellStyle headerCellStyle = wb.createCellStyle(); headerCellStyle.setWrapText( true ); headerCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP); headerCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); HSSFFont headerCellFont = wb.createFont(); //headerCellFont.setFontHeightInPoints((short)12); headerCellFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); headerCellStyle.setFont(headerCellFont); int colIndex = 0; int columnWithUnit = 256; // the unit is 1/256 of a character int numberOfCharactersPerLineInLongTextFields = 60; int numberOfCharactersPerLineInRatherLongTextFields = 35; int numberOfCharactersPerLineInUndifinedTextFields = 20; for (Iterator iter = fields.iterator(); iter.hasNext();colIndex++) { ReportableField field = (ReportableField) iter.next(); HSSFCell headerCell = headerRow.createCell((short)colIndex); headerCell.setCellValue((String)description.getColumnName(field)); headerCell.setCellStyle(headerCellStyle); //column width int fieldsMaxChar = field.getMaxNumberOfCharacters(); int colWith = numberOfCharactersPerLineInRatherLongTextFields*columnWithUnit; //default, can be rather long text if(fieldsMaxChar > 0 && fieldsMaxChar < numberOfCharactersPerLineInRatherLongTextFields){ colWith = (fieldsMaxChar+1)*columnWithUnit; // short fields } else if(fieldsMaxChar > 500){ // when the field is set to be able to contain very long text colWith = numberOfCharactersPerLineInLongTextFields*columnWithUnit; //can be very long text } else if(fieldsMaxChar < 0){ colWith = numberOfCharactersPerLineInUndifinedTextFields*columnWithUnit; } sheet.setColumnWidth((short)colIndex,(short)colWith); } //-- Report ColumnDetail --// try { HSSFCellStyle dataCellStyle = wb.createCellStyle(); dataCellStyle.setWrapText( true ); dataCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP); sheet.createFreezePane( 0, rowIndex ); while(reportData.next()){ HSSFRow dataRow = sheet.createRow((short)rowIndex++); colIndex = 0; for (Iterator iter = fields.iterator(); iter.hasNext();colIndex++) { ReportableField field = (ReportableField) iter.next(); HSSFCell dataCell = dataRow.createCell((short)colIndex); Object fieldValue = reportData.getFieldValue(field); if(fieldValue != null){ dataCell.setCellValue(String.valueOf(fieldValue)); } dataCell.setCellStyle(dataCellStyle); } } } catch (JRException e) { //-- Exception fetching data --// HSSFRow exceptionRow = sheet.createRow((short)rowIndex++); HSSFCell exceptionCell = exceptionRow.createCell((short)0); // Create a new font and alter it. HSSFFont exceptionFont = wb.createFont(); exceptionFont.setFontName("Courier New"); exceptionFont.setItalic(true); // Fonts are set into a style so create a new one to use. HSSFCellStyle exceptionStyle = wb.createCellStyle(); exceptionStyle.setFont(exceptionFont); // Create a cell and put a value in it. exceptionCell.setCellValue("Error occurred while getting data. Check log for more details."); exceptionCell.setCellStyle(exceptionStyle); e.printStackTrace(); } // Write the output to a file FileOutputStream fileOut = new FileOutputStream(filePathAndName); wb.write(fileOut); fileOut.close(); } |
semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.StereotypeEditPart.VISUAL_ID); | semanticHint = UMLVisualIDRegistry.getType(StereotypeEditPart.VISUAL_ID); | protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) { if (semanticHint == null) { semanticHint = UMLVisualIDRegistry.getType(org.eclipse.uml2.diagram.profile.edit.parts.StereotypeEditPart.VISUAL_ID); view.setType(semanticHint); } super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted); if (!ProfileEditPart.MODEL_ID.equals(UMLVisualIDRegistry.getModelID(containerView))) { EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation(); shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$ shortcutAnnotation.getDetails().put("modelID", ProfileEditPart.MODEL_ID); //$NON-NLS-1$ view.getEAnnotations().add(shortcutAnnotation); } getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(StereotypeNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(StereotypeAttributesEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); getViewService().createNode(semanticAdapter, view, UMLVisualIDRegistry.getType(StereotypeConstraintsEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint()); } |
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy()); | protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy()); installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RegionSubvertices2ItemSemanticEditPolicy()); installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new RegionSubvertices2CanonicalEditPolicy()); } |
|
firePlaybackCompleted(player); | next(); | public void playbackCompleted() { firePlaybackCompleted(player); } |
firePlaybackCompleted(player); | next(); | public void playbackFailed() { firePlaybackCompleted(player); } |
firePlaybackStarted(player); | public void playbackStarted() { firePlaybackStarted(player); } |
|
firePlaybackStopped(player); | public void playbackStopped() { firePlaybackStopped(player); } |
|
return player; | return (playerThread != null) ? playerThread.getPlayer() : null; | public Player getPlayer() { return player; } |
return (player != null) ? player.getResource() : null; | return (getPlayer() != null) ? getPlayer().getResource() : null; | public URL getPlayingURL() { return (player != null) ? player.getResource() : null; } |
return player != null && player.isPlaying(); | return getPlayer() != null && getPlayer().isPlaying(); | public synchronized boolean isPlaying() { return player != null && player.isPlaying(); } |
if (p1.account == null) { throw new RuntimeException("Null account for UserVO object id=" + p1.getId()); | if (p1.getKind() < p2.getKind()) { return -1; | public int compare(Object o1, Object o2) { if (!(o1 instanceof BwPrincipal)) { return -1; } if (!(o2 instanceof BwPrincipal)) { return 1; } BwPrincipal p1 = (BwPrincipal)o1; BwPrincipal p2 = (BwPrincipal)o2; if (p1.account == null) { // Should not happen throw new RuntimeException("Null account for UserVO object id=" + p1.getId()); } if (p2.account == null) { // Should not happen throw new RuntimeException("Null account for UserVO object id=" + p2.getId()); } return p1.account.compareTo(p2.account); } |
if (p2.account == null) { throw new RuntimeException("Null account for UserVO object id=" + p2.getId()); | if (p1.getKind() > p2.getKind()) { return 1; | public int compare(Object o1, Object o2) { if (!(o1 instanceof BwPrincipal)) { return -1; } if (!(o2 instanceof BwPrincipal)) { return 1; } BwPrincipal p1 = (BwPrincipal)o1; BwPrincipal p2 = (BwPrincipal)o2; if (p1.account == null) { // Should not happen throw new RuntimeException("Null account for UserVO object id=" + p1.getId()); } if (p2.account == null) { // Should not happen throw new RuntimeException("Null account for UserVO object id=" + p2.getId()); } return p1.account.compareTo(p2.account); } |
return p1.account.compareTo(p2.account); | return CalFacadeUtil.compareStrings(p1.getAccount(), p2.getAccount()); | public int compare(Object o1, Object o2) { if (!(o1 instanceof BwPrincipal)) { return -1; } if (!(o2 instanceof BwPrincipal)) { return 1; } BwPrincipal p1 = (BwPrincipal)o1; BwPrincipal p2 = (BwPrincipal)o2; if (p1.account == null) { // Should not happen throw new RuntimeException("Null account for UserVO object id=" + p1.getId()); } if (p2.account == null) { // Should not happen throw new RuntimeException("Null account for UserVO object id=" + p2.getId()); } return p1.account.compareTo(p2.account); } |
t.printStackTrace(); | public int doEndTag() throws JspTagException { try { /* Try to retrieve the value */ String val = getString(false); JspWriter out = pageContext.getOut(); if (tagName == null) { tagName = property; } // Assume we're indented for the first tag out.print('<'); out.print(tagName); if (indent != null) { out.println('>'); if (val != null) { out.print(indent); out.print(" "); out.println(formatted(val)); } out.print(indent); out.println("</"); } else { out.print('>'); if (val != null) { out.print(formatted(val)); } out.print("</"); } out.print(tagName); out.println('>'); } catch(Throwable t) { throw new JspTagException("Error: " + t.getMessage()); } finally { tagName = null; // reset for next time. filter = true; // reset for next time. } return EVAL_PAGE; } |
|
Properties uidprops = new Properties(); uidprops.setProperty("separator", "-"); uuidGen = new UUIDHexGenerator(); ((Configurable)uuidGen).configure(Hibernate.STRING, uidprops, null); | public Events(Calintf cal, AccessUtil access, BwUser user, boolean debug) { super(cal, access, user, debug); Properties uidprops = new Properties(); uidprops.setProperty("separator", "-"); uuidGen = new UUIDHexGenerator(); ((Configurable)uuidGen).configure(Hibernate.STRING, uidprops, null); } |
|
String guidPrefix = "CAL-" + (String)uuidGen.generate(null, null); | String guidPrefix = "CAL-" + (String)getUuidGen().generate(null, null); | public void assignGuid(BwEvent val) throws CalFacadeException { if (val == null) { return; } String guidPrefix = "CAL-" + (String)uuidGen.generate(null, null); if (val.getName() == null) { val.setName(guidPrefix + ".ics"); } if (val.getGuid() != null) { return; } String guid = guidPrefix + cal.getSysid(); val.setGuid(guid); } |
if (debug) { trace("getEvents for start=" + startDate + " end=" + endDate); } | public Collection getEvents(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval, int currentMode, boolean ignoreCreator) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); //if (debug) { // log.debug("getEvents for " + objTimestamp + " start=" + // startDate + " end=" + endDate); //} /* Name of the event in the query */ final String qevName = "ev"; Filters flt = new Filters(filter, sb, qevName, debug); /* SEG: from Events ev where */ sb.append("from "); sb.append(BwEvent.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* Don't retrieve any master records - I guess we might have a choice to retrieve any with the dates in the given range */ sb.append(qevName); sb.append(".recurring = false and "); /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName, calendar, currentMode, ignoreCreator); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // trace(sb.toString()); //} sess.createQuery(sb.toString()); /* XXX Limit result set size - pagination allows something like: query.setFirstResult(0); query.setMaxResults(10); */ if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar); flt.parPass(sess); Collection es = sess.getList(); es = postGetEvents(es, privRead, noAccessReturnsNull); /** Run the events we got through the filters */ es = flt.postExec(es); Collection rs = getLimitedRecurrences(calendar, filter, startDate, endDate, currentMode, ignoreCreator, recurRetrieval); if (rs != null) { es.addAll(rs); } return es; } |
|
if (debug) { trace("Found " + es.size() + " events"); } | public Collection getEvents(BwCalendar calendar, BwFilter filter, BwDateTime startDate, BwDateTime endDate, int recurRetrieval, int currentMode, boolean ignoreCreator) throws CalFacadeException { HibSession sess = getSess(); StringBuffer sb = new StringBuffer(); //if (debug) { // log.debug("getEvents for " + objTimestamp + " start=" + // startDate + " end=" + endDate); //} /* Name of the event in the query */ final String qevName = "ev"; Filters flt = new Filters(filter, sb, qevName, debug); /* SEG: from Events ev where */ sb.append("from "); sb.append(BwEvent.class.getName()); sb.append(" "); sb.append(qevName); sb.append(" where "); /* SEG: (<date-ranges>) and */ if (appendDateTerms(sb, qevName + ".dtstart.date", qevName + ".dtend.date", startDate, endDate)) { sb.append(" and "); } /* Don't retrieve any master records - I guess we might have a choice to retrieve any with the dates in the given range */ sb.append(qevName); sb.append(".recurring = false and "); /* SEG ( */ sb.append(" ("); boolean setUser = doCalendarClause(sb, qevName, calendar, currentMode, ignoreCreator); sb.append(") "); flt.addWhereFilters(); sb.append(" order by "); sb.append(qevName); sb.append(".dtstart.dtval"); //if (debug) { // trace(sb.toString()); //} sess.createQuery(sb.toString()); /* XXX Limit result set size - pagination allows something like: query.setFirstResult(0); query.setMaxResults(10); */ if (startDate != null) { sess.setString("fromDate", startDate.getDate()); } if (endDate != null) { sess.setString("toDate", endDate.getDate()); } doCalendarEntities(setUser, calendar); flt.parPass(sess); Collection es = sess.getList(); es = postGetEvents(es, privRead, noAccessReturnsNull); /** Run the events we got through the filters */ es = flt.postExec(es); Collection rs = getLimitedRecurrences(calendar, filter, startDate, endDate, currentMode, ignoreCreator, recurRetrieval); if (rs != null) { es.addAll(rs); } return es; } |
|
public static int openError(Shell parentShell, String title, String message, IStatus status, int displayMask) { ErrorDialog dialog = new ErrorDialog(parentShell, title, message, status, displayMask); return dialog.open(); | public static int openError(Shell parent, String dialogTitle, String message, IStatus status) { return openError(parent, dialogTitle, message, status, IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR); | public static int openError(Shell parentShell, String title, String message, IStatus status, int displayMask) { ErrorDialog dialog = new ErrorDialog(parentShell, title, message, status, displayMask); return dialog.open();} |
public void put(String key,String value); | public void put(String key, String[] value); | public void put(String key,String value); |
public final void sourceChanged(final int sourcePriority, final String sourceName, final Object sourceValue) { updateEvaluationContext(sourceName, sourceValue); sourceChanged(sourcePriority); } | protected abstract void sourceChanged(final int sourcePriority); | public final void sourceChanged(final int sourcePriority, final String sourceName, final Object sourceValue) { updateEvaluationContext(sourceName, sourceValue); sourceChanged(sourcePriority); } |
protected void internalRefresh(Widget widget, Object element, boolean doStruct, boolean updateLabels) { if (widget instanceof Item) { if (doStruct) { updatePlus((Item) widget, element); } if (updateLabels || !equals(element, widget.getData())) { doUpdateItem(widget, element, true); } else { associate(element, (Item) widget); } } if (doStruct) { internalRefreshStruct(widget, element, updateLabels); } else { Item[] children = getChildren(widget); if (children != null) { for (int i = 0; i < children.length; i++) { Widget item = children[i]; Object data = item.getData(); if (data != null) internalRefresh(item, data, doStruct, updateLabels); } } } | protected void internalRefresh(Object element) { internalRefresh(element, true); | protected void internalRefresh(Widget widget, Object element, boolean doStruct, boolean updateLabels) { if (widget instanceof Item) { if (doStruct) { updatePlus((Item) widget, element); } if (updateLabels || !equals(element, widget.getData())) { doUpdateItem(widget, element, true); } else { associate(element, (Item) widget); } } if (doStruct) { internalRefreshStruct(widget, element, updateLabels); } else { Item[] children = getChildren(widget); if (children != null) { for (int i = 0; i < children.length; i++) { Widget item = children[i]; Object data = item.getData(); if (data != null) internalRefresh(item, data, doStruct, updateLabels); } } } } |
public static IEditorPart openEditor(IWorkbenchPage page, IFile input) throws PartInitException { if (page == null) { | public static IEditorPart openEditor(IWorkbenchPage page, IEditorInput input, String editorId) throws PartInitException { if (page == null) { | public static IEditorPart openEditor(IWorkbenchPage page, IFile input) throws PartInitException { //sanity checks if (page == null) { throw new IllegalArgumentException(); } // open the editor on the file IEditorDescriptor editorDesc = getEditorDescriptor(input); return page.openEditor(new FileEditorInput(input), editorDesc.getId()); } |
IEditorDescriptor editorDesc = getEditorDescriptor(input); return page.openEditor(new FileEditorInput(input), editorDesc.getId()); } | return page.openEditor(input, editorId); } | public static IEditorPart openEditor(IWorkbenchPage page, IFile input) throws PartInitException { //sanity checks if (page == null) { throw new IllegalArgumentException(); } // open the editor on the file IEditorDescriptor editorDesc = getEditorDescriptor(input); return page.openEditor(new FileEditorInput(input), editorDesc.getId()); } |
final boolean parametersChanged, final boolean returnTypeChanged) { super(definedChanged, descriptionChanged, nameChanged); if (command == null) throw new NullPointerException(); this.command = command; if (categoryChanged) { changedValues |= CHANGED_CATEGORY; } if (handledChanged) { changedValues |= CHANGED_HANDLED; } if (parametersChanged) { changedValues |= CHANGED_PARAMETERS; } if (returnTypeChanged) { changedValues |= CHANGED_RETURN_TYPE; } | final boolean parametersChanged) { this(command, categoryChanged, definedChanged, descriptionChanged, handledChanged, nameChanged, parametersChanged, false); | public CommandEvent(final Command command, final boolean categoryChanged, final boolean definedChanged, final boolean descriptionChanged, final boolean handledChanged, final boolean nameChanged, final boolean parametersChanged, final boolean returnTypeChanged) { super(definedChanged, descriptionChanged, nameChanged); if (command == null) throw new NullPointerException(); this.command = command; if (categoryChanged) { changedValues |= CHANGED_CATEGORY; } if (handledChanged) { changedValues |= CHANGED_HANDLED; } if (parametersChanged) { changedValues |= CHANGED_PARAMETERS; } if (returnTypeChanged) { changedValues |= CHANGED_RETURN_TYPE; } } |
public static final KeySequence getInstance(final KeyStroke[] keyStrokes) { return new KeySequence(keyStrokes); | public static final KeySequence getInstance() { return EMPTY_KEY_SEQUENCE; | public static final KeySequence getInstance(final KeyStroke[] keyStrokes) { return new KeySequence(keyStrokes); } |
public WritableValue(Object valueType, Object initialValue) { this(Realm.getDefault(), valueType, initialValue); | public WritableValue(Object initialValue) { this(Realm.getDefault(), null, initialValue); | public WritableValue(Object valueType, Object initialValue) { this(Realm.getDefault(), valueType, initialValue); } |
public void insertAfter(String ID, IContributionItem item) { IContributionItem ci = find(ID); if (ci == null) { throw new IllegalArgumentException("can't find ID"); } int ix = contributions.indexOf(ci); if (ix >= 0) { if (allowItem(item)) { contributions.add(ix + 1, item); itemAdded(item); } } | public void insertAfter(String ID, IAction action) { insertAfter(ID, new ActionContributionItem(action)); | public void insertAfter(String ID, IContributionItem item) { IContributionItem ci = find(ID); if (ci == null) { throw new IllegalArgumentException("can't find ID");//$NON-NLS-1$ } int ix = contributions.indexOf(ci); if (ix >= 0) { // System.out.println("insert after: " + ix); if (allowItem(item)) { contributions.add(ix + 1, item); itemAdded(item); } } } |
null, | public List getAllCheckedListItems(IProgressMonitor monitor) { List result = new ArrayList(); //Iterate through the children of the root as the root is not in the store Object[] children = treeContentProvider.getChildren(root); for (int i = 0; i < children.length; ++i) { findAllSelectedListElements( children[i], whiteCheckedTreeItems.contains(children[i]), result, monitor); } if(monitor != null && monitor.isCanceled()) return null; else return result;} |
|
public void add(IPerspectiveDescriptor desc) { if (shortcuts.contains(desc)) return; int size = shortcuts.size(); int preferredSize = DEFAULT_DEPTH; while (size >= preferredSize) { size--; shortcuts.remove(size); } shortcuts.add(0, desc); fireChange(); | public void add(String id) { IPerspectiveDescriptor desc = reg.findPerspectiveWithId(id); if (desc != null) add(desc); | public void add(IPerspectiveDescriptor desc) { // Avoid duplicates if (shortcuts.contains(desc)) return; // If the shortcut list will be too long, remove oldest ones int size = shortcuts.size(); int preferredSize = DEFAULT_DEPTH; while (size >= preferredSize) { size--; shortcuts.remove(size); } // Insert at top as most recent shortcuts.add(0, desc); fireChange(); } |
public void closeAllPages(boolean save) { if (save) { boolean ret = saveAllPages(true); if (!ret) return; | private void closeAllPages() { setActivePage(null); PageList oldList = pageList; pageList = new PageList(); Iterator itr = oldList.iterator(); while (itr.hasNext()) { WorkbenchPage page = (WorkbenchPage) itr.next(); firePageClosed(page); page.dispose(); | public void closeAllPages(boolean save) { if (save) { boolean ret = saveAllPages(true); if (!ret) return; } closeAllPages(); } |
closeAllPages(); | if (!closing) showEmptyWindowContents(); | public void closeAllPages(boolean save) { if (save) { boolean ret = saveAllPages(true); if (!ret) return; } closeAllPages(); } |
public TreeFrame(AbstractTreeViewer viewer, Object input) { this(viewer); setInput(input); ILabelProvider provider = (ILabelProvider) viewer.getLabelProvider(); String name = provider.getText(input); if(name == null) { name = ""; } setName(name); setToolTipText(name); | public TreeFrame(AbstractTreeViewer viewer) { this.viewer = viewer; | public TreeFrame(AbstractTreeViewer viewer, Object input) { this(viewer); setInput(input); ILabelProvider provider = (ILabelProvider) viewer.getLabelProvider(); String name = provider.getText(input); if(name == null) { name = "";//$NON-NLS-1$ } setName(name); setToolTipText(name); } |
public static int compare(List left, List right) { if (left == null && right == null) return 0; else if (left == null) return -1; else if (right == null) return 1; else { int l = left.size(); int r = right.size(); if (l != r) return l - r; else { for (int i = 0; i < l; i++) { int compareTo = compare((Comparable) left.get(i), (Comparable) right.get(i)); if (compareTo != 0) return compareTo; } return 0; } } | public static int compare(boolean left, boolean right) { return left == false ? (right == true ? -1 : 0) : 1; | public static int compare(List left, List right) { if (left == null && right == null) return 0; else if (left == null) return -1; else if (right == null) return 1; else { int l = left.size(); int r = right.size(); if (l != r) return l - r; else { for (int i = 0; i < l; i++) { int compareTo = compare((Comparable) left.get(i), (Comparable) right.get(i)); if (compareTo != 0) return compareTo; } return 0; } } } |
IObservable modelObservable, BindSpec bindSpec) { | IObservable modelObservable, org.eclipse.jface.databinding.BindSpec bindSpec) { | public Binding bind(IObservable targetObservable, IObservable modelObservable, BindSpec bindSpec) { Binding result = doCreateBinding(targetObservable, modelObservable, bindSpec, this); if (result != null) return result; throw new BindingException( "No binding found for target: " + targetObservable.getClass().getName() + ", model: " + modelObservable.getClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$ } |
public DialogMarkerProperties(Shell parentShell, String title) { | public DialogMarkerProperties(Shell parentShell) { | public DialogMarkerProperties(Shell parentShell, String title) { super(parentShell); setShellStyle(getShellStyle() | SWT.RESIZE); this.title = title; } |
this.title = title; | public DialogMarkerProperties(Shell parentShell, String title) { super(parentShell); setShellStyle(getShellStyle() | SWT.RESIZE); this.title = title; } |
|
public IViewReference createView(String id, String secondaryId) throws PartInitException { IViewDescriptor desc = viewReg.find(id); if (desc == null) throw new PartInitException(WorkbenchMessages.format("ViewFactory.couldNotCreate", new Object[] { id })); if (secondaryId != null) { if (!desc.getAllowMultiple()) { throw new PartInitException(WorkbenchMessages.format("ViewFactory.noMultiple", new Object[] { id })); } } String key = getKey(id, secondaryId); IViewReference ref = (IViewReference) counter.get(key); if (ref == null) { IMemento memento = (IMemento)mementoTable.get(id); ref = new ViewReference(id, secondaryId, memento); counter.put(key, ref); } else { counter.addRef(key); } return ref; | public IViewReference createView(final String id) throws PartInitException { return createView(id, null); | public IViewReference createView(String id, String secondaryId) throws PartInitException { IViewDescriptor desc = viewReg.find(id); // ensure that the view id is valid if (desc == null) throw new PartInitException(WorkbenchMessages.format("ViewFactory.couldNotCreate", new Object[] { id })); //$NON-NLS-1$ // ensure that multiple instances are allowed if a secondary id is given if (secondaryId != null) { if (!desc.getAllowMultiple()) { throw new PartInitException(WorkbenchMessages.format("ViewFactory.noMultiple", new Object[] { id })); //$NON-NLS-1$ } } String key = getKey(id, secondaryId); IViewReference ref = (IViewReference) counter.get(key); if (ref == null) { IMemento memento = (IMemento)mementoTable.get(id); ref = new ViewReference(id, secondaryId, memento); counter.put(key, ref); } else { counter.addRef(key); } return ref; } |
public PartStack(int appearance, AbstractPresentationFactory factory) { super("PartStack"); this.appearance = appearance; this.factory = factory; | public PartStack(int appearance) { this(appearance, null); | public PartStack(int appearance, AbstractPresentationFactory factory) { super("PartStack"); //$NON-NLS-1$ this.appearance = appearance; this.factory = factory; } |
public void setPerspective(final IPerspectiveDescriptor desc) { if (Util.equals(getPerspective(), desc)) { return; } ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2(); | private void setPerspective(Perspective newPersp) { Perspective oldPersp = getActivePerspective(); if (oldPersp == newPersp) { return; } window.largeUpdateStart(); | public void setPerspective(final IPerspectiveDescriptor desc) { if (Util.equals(getPerspective(), desc)) { return; } // Going from multiple to single rows can make the coolbar // and its adjacent views appear jumpy as perspectives are // switched. Turn off redraw to help with this. ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2(); try { mgr.getControl2().setRedraw(false); getClientComposite().setRedraw(false); // Run op in busy cursor. BusyIndicator.showWhile(null, new Runnable() { public void run() { busySetPerspective(desc); } }); } finally { getClientComposite().setRedraw(true); mgr.getControl2().setRedraw(true); IWorkbenchPart part = getActivePart(); if (part != null) { part.setFocus(); } } } |
mgr.getControl2().setRedraw(false); getClientComposite().setRedraw(false); BusyIndicator.showWhile(null, new Runnable() { public void run() { busySetPerspective(desc); | if (oldPersp != null) { window.firePerspectivePreDeactivate(this, oldPersp.getDesc()); } if (newPersp != null) { IStatus status = newPersp.restoreState(); if (status.getSeverity() != IStatus.OK) { String title = WorkbenchMessages.WorkbenchPage_problemRestoringTitle; String msg = WorkbenchMessages.WorkbenchPage_errorReadingState; ErrorDialog.openError(getWorkbenchWindow().getShell(), title, msg, status); } } if (oldPersp != null) { oldPersp.onDeactivate(); window.firePerspectiveDeactivated(this, oldPersp.getDesc()); } perspList.setActive(newPersp); if (newPersp != null) { newPersp.onActivate(); window.firePerspectiveActivated(this, newPersp.getDesc()); } updateVisibility(oldPersp, newPersp); window.updateActionSets(); if (newPersp != null && oldPersp != null) { Set activatedStickyViewsInThisPerspective = (Set) stickyPerspectives.get(newPersp.getDesc().getId()); if (activatedStickyViewsInThisPerspective == null) { activatedStickyViewsInThisPerspective = new HashSet(7); stickyPerspectives.put(newPersp.getDesc().getId(), activatedStickyViewsInThisPerspective); } IViewRegistry viewReg = WorkbenchPlugin.getDefault() .getViewRegistry(); IStickyViewDescriptor[] stickyDescs = viewReg.getStickyViews(); for (int i = 0; i < stickyDescs.length; i++) { final String viewId = stickyDescs[i].getId(); try { if (oldPersp.findView(viewId) != null && !activatedStickyViewsInThisPerspective .contains(viewId)) { showView(viewId, null, IWorkbenchPage.VIEW_CREATE); activatedStickyViewsInThisPerspective.add(viewId); } } catch (PartInitException e) { WorkbenchPlugin .log( "Could not open view :" + viewId, new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, "Could not open view :" + viewId, e)); } | public void setPerspective(final IPerspectiveDescriptor desc) { if (Util.equals(getPerspective(), desc)) { return; } // Going from multiple to single rows can make the coolbar // and its adjacent views appear jumpy as perspectives are // switched. Turn off redraw to help with this. ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2(); try { mgr.getControl2().setRedraw(false); getClientComposite().setRedraw(false); // Run op in busy cursor. BusyIndicator.showWhile(null, new Runnable() { public void run() { busySetPerspective(desc); } }); } finally { getClientComposite().setRedraw(true); mgr.getControl2().setRedraw(true); IWorkbenchPart part = getActivePart(); if (part != null) { part.setFocus(); } } } |
}); | } | public void setPerspective(final IPerspectiveDescriptor desc) { if (Util.equals(getPerspective(), desc)) { return; } // Going from multiple to single rows can make the coolbar // and its adjacent views appear jumpy as perspectives are // switched. Turn off redraw to help with this. ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2(); try { mgr.getControl2().setRedraw(false); getClientComposite().setRedraw(false); // Run op in busy cursor. BusyIndicator.showWhile(null, new Runnable() { public void run() { busySetPerspective(desc); } }); } finally { getClientComposite().setRedraw(true); mgr.getControl2().setRedraw(true); IWorkbenchPart part = getActivePart(); if (part != null) { part.setFocus(); } } } |
getClientComposite().setRedraw(true); mgr.getControl2().setRedraw(true); IWorkbenchPart part = getActivePart(); if (part != null) { part.setFocus(); | window.largeUpdateEnd(); if (newPersp == null) { return; | public void setPerspective(final IPerspectiveDescriptor desc) { if (Util.equals(getPerspective(), desc)) { return; } // Going from multiple to single rows can make the coolbar // and its adjacent views appear jumpy as perspectives are // switched. Turn off redraw to help with this. ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2(); try { mgr.getControl2().setRedraw(false); getClientComposite().setRedraw(false); // Run op in busy cursor. BusyIndicator.showWhile(null, new Runnable() { public void run() { busySetPerspective(desc); } }); } finally { getClientComposite().setRedraw(true); mgr.getControl2().setRedraw(true); IWorkbenchPart part = getActivePart(); if (part != null) { part.setFocus(); } } } |
IPerspectiveDescriptor desc = newPersp.getDesc(); if (desc == null) { return; } if (dirtyPerspectives.remove(desc.getId())) { suggestReset(); } | public void setPerspective(final IPerspectiveDescriptor desc) { if (Util.equals(getPerspective(), desc)) { return; } // Going from multiple to single rows can make the coolbar // and its adjacent views appear jumpy as perspectives are // switched. Turn off redraw to help with this. ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2(); try { mgr.getControl2().setRedraw(false); getClientComposite().setRedraw(false); // Run op in busy cursor. BusyIndicator.showWhile(null, new Runnable() { public void run() { busySetPerspective(desc); } }); } finally { getClientComposite().setRedraw(true); mgr.getControl2().setRedraw(true); IWorkbenchPart part = getActivePart(); if (part != null) { part.setFocus(); } } } |
|
public SLocation(final SLocation parent, final String id) { this(parent, id, MNEMONIC_NONE); | public SLocation() { this(new SBar()); | public SLocation(final SLocation parent, final String id) { this(parent, id, MNEMONIC_NONE); } |
public static final boolean equals(final Object[] leftArray, final Object[] rightArray) { if (leftArray.length != rightArray.length) { return false; } for (int i = 0; i < leftArray.length; i++) { final Object left = leftArray[i]; final Object right = rightArray[i]; final boolean equal = (left == null) ? (right == null) : (left .equals(right)); if (!equal) { return false; } } return true; | public static final boolean equals(final Object left, final Object right) { return left == null ? right == null : ((right != null) && left .equals(right)); | public static final boolean equals(final Object[] leftArray, final Object[] rightArray) { if (leftArray.length != rightArray.length) { return false; } for (int i = 0; i < leftArray.length; i++) { final Object left = leftArray[i]; final Object right = rightArray[i]; final boolean equal = (left == null) ? (right == null) : (left .equals(right)); if (!equal) { return false; } } return true; } |
public void hideView(IViewPart view) { hideView((IViewReference)getReference(view)); | public void hideView(IViewReference ref) { if (ref == null) { return; } Perspective persp = getActivePerspective(); if (persp == null) { return; } boolean promptedForSave = false; IViewPart view = ref.getView(false); if (view != null) { if (!certifyPart(view)) { return; } if (view instanceof ISaveablePart) { ISaveablePart saveable = (ISaveablePart)view; if (saveable.isSaveOnCloseNeeded()) { IWorkbenchWindow window = view.getSite().getWorkbenchWindow(); boolean success = EditorManager.saveAll(Collections.singletonList(view), true, true, false, window); if (!success) { return; } promptedForSave = true; } } } int refCount = getViewFactory().getReferenceCount(ref); SaveablesList saveablesList = null; Object postCloseInfo = null; if (refCount == 1) { IWorkbenchPart actualPart = ref.getPart(false); if (actualPart != null) { saveablesList = (SaveablesList) actualPart .getSite().getService(ISaveablesLifecycleListener.class); postCloseInfo = saveablesList.preCloseParts(Collections .singletonList(actualPart), !promptedForSave, this .getWorkbenchWindow()); if (postCloseInfo==null) { return; } } } window.firePerspectiveChanged(this, persp.getDesc(), ref, CHANGE_VIEW_HIDE); PartPane pane = getPane(ref); pane.setInLayout(false); updateActivePart(); if (saveablesList != null) { saveablesList.postClose(postCloseInfo); } persp.hideView(ref); window.firePerspectiveChanged(this, getPerspective(), CHANGE_VIEW_HIDE); | public void hideView(IViewPart view) { hideView((IViewReference)getReference(view)); } |
public void selectionChanged(SelectionChangedEvent event) { ISelection sel = event.getSelection(); if (sel instanceof IStructuredSelection) selectionChanged((IStructuredSelection) sel); | public void selectionChanged(IStructuredSelection newSelection) { this.selection = newSelection; if (delegate == null) { if (isOkToCreateDelegate()) delegate = createDelegate(); } if (hasAdaptableType()) this.selection = getResourceAdapters(newSelection); if (enabler != null) { setEnabled(enabler.isEnabledForSelection(selection)); } if (delegate != null) { delegate.selectionChanged(this, selection); } | public void selectionChanged(SelectionChangedEvent event) { ISelection sel = event.getSelection(); if (sel instanceof IStructuredSelection) selectionChanged((IStructuredSelection) sel); } |
public FontFieldEditor(String name, String labelText, String previewAreaText, Composite parent) { init(name, labelText); previewText = previewAreaText; changeButtonText = JFaceResources.getString("openChange"); createControl(parent); | protected FontFieldEditor() { | public FontFieldEditor(String name, String labelText, String previewAreaText, Composite parent) { init(name, labelText); previewText = previewAreaText; changeButtonText = JFaceResources.getString("openChange"); //$NON-NLS-1$ createControl(parent); } |
public static ImageDescriptor createFromImage(Image img, Device theDevice) { return new ImageDataImageDescriptor(img, theDevice); | public static ImageDescriptor createFromImage(Image img) { return new ImageDataImageDescriptor(img); | public static ImageDescriptor createFromImage(Image img, Device theDevice) { return new ImageDataImageDescriptor(img, theDevice); } |
public void fill(Menu parent, int index) { | public void fill(Composite parent) { | public void fill(Menu parent, int index) { if (widget == null && parent != null) { Menu subMenu = null; int flags = SWT.PUSH; if (action != null) { int style = action.getStyle(); if (style == IAction.AS_CHECK_BOX) { flags = SWT.CHECK; } else if (style == IAction.AS_RADIO_BUTTON) { flags = SWT.RADIO; } else if (style == IAction.AS_DROP_DOWN_MENU) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { subMenu = mc.getMenu(parent); flags = SWT.CASCADE; } } } MenuItem mi = null; if (index >= 0) { mi = new MenuItem(parent, flags, index); } else { mi = new MenuItem(parent, flags); } widget = mi; mi.setData(this); mi.addListener(SWT.Dispose, getMenuItemListener()); mi.addListener(SWT.Selection, getMenuItemListener()); if (action.getHelpListener() != null) { mi.addHelpListener(action.getHelpListener()); } if (subMenu != null) { mi.setMenu(subMenu); } update(null); // Attach some extra listeners. action.addPropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.addPropertyChangeListener(commandId, actionTextListener); } } } } |
Menu subMenu = null; | public void fill(Menu parent, int index) { if (widget == null && parent != null) { Menu subMenu = null; int flags = SWT.PUSH; if (action != null) { int style = action.getStyle(); if (style == IAction.AS_CHECK_BOX) { flags = SWT.CHECK; } else if (style == IAction.AS_RADIO_BUTTON) { flags = SWT.RADIO; } else if (style == IAction.AS_DROP_DOWN_MENU) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { subMenu = mc.getMenu(parent); flags = SWT.CASCADE; } } } MenuItem mi = null; if (index >= 0) { mi = new MenuItem(parent, flags, index); } else { mi = new MenuItem(parent, flags); } widget = mi; mi.setData(this); mi.addListener(SWT.Dispose, getMenuItemListener()); mi.addListener(SWT.Selection, getMenuItemListener()); if (action.getHelpListener() != null) { mi.addHelpListener(action.getHelpListener()); } if (subMenu != null) { mi.setMenu(subMenu); } update(null); // Attach some extra listeners. action.addPropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.addPropertyChangeListener(commandId, actionTextListener); } } } } |
|
int style = action.getStyle(); if (style == IAction.AS_CHECK_BOX) { flags = SWT.CHECK; } else if (style == IAction.AS_RADIO_BUTTON) { | if (action.getStyle() == IAction.AS_CHECK_BOX) { flags = SWT.TOGGLE; } if (action.getStyle() == IAction.AS_RADIO_BUTTON) { | public void fill(Menu parent, int index) { if (widget == null && parent != null) { Menu subMenu = null; int flags = SWT.PUSH; if (action != null) { int style = action.getStyle(); if (style == IAction.AS_CHECK_BOX) { flags = SWT.CHECK; } else if (style == IAction.AS_RADIO_BUTTON) { flags = SWT.RADIO; } else if (style == IAction.AS_DROP_DOWN_MENU) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { subMenu = mc.getMenu(parent); flags = SWT.CASCADE; } } } MenuItem mi = null; if (index >= 0) { mi = new MenuItem(parent, flags, index); } else { mi = new MenuItem(parent, flags); } widget = mi; mi.setData(this); mi.addListener(SWT.Dispose, getMenuItemListener()); mi.addListener(SWT.Selection, getMenuItemListener()); if (action.getHelpListener() != null) { mi.addHelpListener(action.getHelpListener()); } if (subMenu != null) { mi.setMenu(subMenu); } update(null); // Attach some extra listeners. action.addPropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.addPropertyChangeListener(commandId, actionTextListener); } } } } |
} else if (style == IAction.AS_DROP_DOWN_MENU) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { subMenu = mc.getMenu(parent); flags = SWT.CASCADE; } } | } | public void fill(Menu parent, int index) { if (widget == null && parent != null) { Menu subMenu = null; int flags = SWT.PUSH; if (action != null) { int style = action.getStyle(); if (style == IAction.AS_CHECK_BOX) { flags = SWT.CHECK; } else if (style == IAction.AS_RADIO_BUTTON) { flags = SWT.RADIO; } else if (style == IAction.AS_DROP_DOWN_MENU) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { subMenu = mc.getMenu(parent); flags = SWT.CASCADE; } } } MenuItem mi = null; if (index >= 0) { mi = new MenuItem(parent, flags, index); } else { mi = new MenuItem(parent, flags); } widget = mi; mi.setData(this); mi.addListener(SWT.Dispose, getMenuItemListener()); mi.addListener(SWT.Selection, getMenuItemListener()); if (action.getHelpListener() != null) { mi.addHelpListener(action.getHelpListener()); } if (subMenu != null) { mi.setMenu(subMenu); } update(null); // Attach some extra listeners. action.addPropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.addPropertyChangeListener(commandId, actionTextListener); } } } } |
MenuItem mi = null; if (index >= 0) { mi = new MenuItem(parent, flags, index); } else { mi = new MenuItem(parent, flags); | Button b = new Button(parent, flags); b.setData(this); b.addListener(SWT.Dispose, getButtonListener()); b.addListener(SWT.Selection, getButtonListener()); if (action.getHelpListener() != null) { b.addHelpListener(action.getHelpListener()); | public void fill(Menu parent, int index) { if (widget == null && parent != null) { Menu subMenu = null; int flags = SWT.PUSH; if (action != null) { int style = action.getStyle(); if (style == IAction.AS_CHECK_BOX) { flags = SWT.CHECK; } else if (style == IAction.AS_RADIO_BUTTON) { flags = SWT.RADIO; } else if (style == IAction.AS_DROP_DOWN_MENU) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { subMenu = mc.getMenu(parent); flags = SWT.CASCADE; } } } MenuItem mi = null; if (index >= 0) { mi = new MenuItem(parent, flags, index); } else { mi = new MenuItem(parent, flags); } widget = mi; mi.setData(this); mi.addListener(SWT.Dispose, getMenuItemListener()); mi.addListener(SWT.Selection, getMenuItemListener()); if (action.getHelpListener() != null) { mi.addHelpListener(action.getHelpListener()); } if (subMenu != null) { mi.setMenu(subMenu); } update(null); // Attach some extra listeners. action.addPropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.addPropertyChangeListener(commandId, actionTextListener); } } } } |
widget = mi; mi.setData(this); mi.addListener(SWT.Dispose, getMenuItemListener()); mi.addListener(SWT.Selection, getMenuItemListener()); if (action.getHelpListener() != null) { mi.addHelpListener(action.getHelpListener()); } if (subMenu != null) { mi.setMenu(subMenu); } | widget = b; | public void fill(Menu parent, int index) { if (widget == null && parent != null) { Menu subMenu = null; int flags = SWT.PUSH; if (action != null) { int style = action.getStyle(); if (style == IAction.AS_CHECK_BOX) { flags = SWT.CHECK; } else if (style == IAction.AS_RADIO_BUTTON) { flags = SWT.RADIO; } else if (style == IAction.AS_DROP_DOWN_MENU) { IMenuCreator mc = action.getMenuCreator(); if (mc != null) { subMenu = mc.getMenu(parent); flags = SWT.CASCADE; } } } MenuItem mi = null; if (index >= 0) { mi = new MenuItem(parent, flags, index); } else { mi = new MenuItem(parent, flags); } widget = mi; mi.setData(this); mi.addListener(SWT.Dispose, getMenuItemListener()); mi.addListener(SWT.Selection, getMenuItemListener()); if (action.getHelpListener() != null) { mi.addHelpListener(action.getHelpListener()); } if (subMenu != null) { mi.setMenu(subMenu); } update(null); // Attach some extra listeners. action.addPropertyChangeListener(propertyListener); if (action != null) { String commandId = action.getActionDefinitionId(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((callback != null) && (commandId != null)) { callback.addPropertyChangeListener(commandId, actionTextListener); } } } } |
public void write(IFile resource, String destinationPath) throws IOException, CoreException { ZipEntry newEntry = new ZipEntry(destinationPath); write(newEntry, resource); | private void write(ZipEntry entry, IFile contents) throws IOException, CoreException { byte[] readBuffer = new byte[4096]; if (!useCompression) { entry.setMethod(ZipEntry.STORED); InputStream contentStream = contents.getContents(false); int length = 0; CRC32 checksumCalculator = new CRC32(); try { int n; while ((n = contentStream.read(readBuffer)) > 0) { checksumCalculator.update(readBuffer, 0, n); length += n; } } finally { if (contentStream != null) { contentStream.close(); } } entry.setSize(length); entry.setCrc(checksumCalculator.getValue()); } outputStream.putNextEntry(entry); InputStream contentStream = contents.getContents(false); try { int n; while ((n = contentStream.read(readBuffer)) > 0) { outputStream.write(readBuffer, 0, n); } } finally { if (contentStream != null) { contentStream.close(); } } outputStream.closeEntry(); | public void write(IFile resource, String destinationPath) throws IOException, CoreException { ZipEntry newEntry = new ZipEntry(destinationPath); write(newEntry, resource); } |
public boolean isPartVisible(IWorkbenchPartReference reference) { IWorkbenchPart part = reference.getPart(false); if (part == null) { return false; } return isPartVisible(part); | public boolean isPartVisible(IWorkbenchPart part) { PartPane pane = getPane(part); return pane != null && pane.getVisible(); | public boolean isPartVisible(IWorkbenchPartReference reference) { IWorkbenchPart part = reference.getPart(false); // Can't be visible if it isn't created yet if (part == null) { return false; } return isPartVisible(part); } |
if(colorProvider == null){ if(usedDecorators){ if(background != null) control.setBackground(background); if(foreground != null) control.setForeground(foreground); } } else{ control.setBackground(background); control.setForeground(foreground); } | if(usedDecorators){ if(background != null) control.setBackground(background); | public void applyFontsAndColors(TreeItem control) { if(colorProvider == null){ if(usedDecorators){ //If there is no provider only apply set values if(background != null) control.setBackground(background); if(foreground != null) control.setForeground(foreground); } } else{ //Always set the value if there is a provider control.setBackground(background); control.setForeground(foreground); } if(fontProvider == null){ if(usedDecorators && font != null) control.setFont(font); } else//Always set the value if there is a provider control.setFont(font); clear(); } |
if(fontProvider == null){ if(usedDecorators && font != null) | if(foreground != null) control.setForeground(foreground); if(font != null) | public void applyFontsAndColors(TreeItem control) { if(colorProvider == null){ if(usedDecorators){ //If there is no provider only apply set values if(background != null) control.setBackground(background); if(foreground != null) control.setForeground(foreground); } } else{ //Always set the value if there is a provider control.setBackground(background); control.setForeground(foreground); } if(fontProvider == null){ if(usedDecorators && font != null) control.setFont(font); } else//Always set the value if there is a provider control.setFont(font); clear(); } |
else control.setFont(font); | public void applyFontsAndColors(TreeItem control) { if(colorProvider == null){ if(usedDecorators){ //If there is no provider only apply set values if(background != null) control.setBackground(background); if(foreground != null) control.setForeground(foreground); } } else{ //Always set the value if there is a provider control.setBackground(background); control.setForeground(foreground); } if(fontProvider == null){ if(usedDecorators && font != null) control.setFont(font); } else//Always set the value if there is a provider control.setFont(font); clear(); } |
|
public void update(String propertyName) { if (widget != null) { boolean textChanged = propertyName == null || propertyName.equals(IAction.TEXT); boolean imageChanged = propertyName == null || propertyName.equals(IAction.IMAGE); boolean tooltipTextChanged = propertyName == null || propertyName.equals(IAction.TOOL_TIP_TEXT); boolean enableStateChanged = propertyName == null || propertyName.equals(IAction.ENABLED) || propertyName .equals(IContributionManagerOverrides.P_ENABLED); boolean checkChanged = (action.getStyle() == IAction.AS_CHECK_BOX || action .getStyle() == IAction.AS_RADIO_BUTTON) && (propertyName == null || propertyName .equals(IAction.CHECKED)); if (widget instanceof ToolItem) { ToolItem ti = (ToolItem) widget; String text = action.getText(); boolean showText = text != null && ((getMode() & MODE_FORCE_TEXT) != 0 || !hasImages(action)); if (showText && text != null) { text = Action.removeAcceleratorText(text); text = Action.removeMnemonics(text); } if (textChanged) { String textToSet = showText ? text : ""; boolean rightStyle = (ti.getParent().getStyle() & SWT.RIGHT) != 0; if (rightStyle || !ti.getText().equals(textToSet)) { ti.setText(textToSet); } } if (imageChanged) { updateImages(!showText); } if (tooltipTextChanged || textChanged) { String toolTip = action.getToolTipText(); if ((toolTip == null) || (toolTip.length() == 0)) { toolTip = text; } if (!showText || toolTip != null && !toolTip.equals(text)) { ti.setToolTipText(toolTip); } else { ti.setToolTipText(null); } } if (enableStateChanged) { boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed(); if (ti.getEnabled() != shouldBeEnabled) { ti.setEnabled(shouldBeEnabled); } } if (checkChanged) { boolean bv = action.isChecked(); if (ti.getSelection() != bv) { ti.setSelection(bv); } } return; } if (widget instanceof MenuItem) { MenuItem mi = (MenuItem) widget; if (textChanged) { int accelerator = 0; String acceleratorText = null; IAction updatedAction = getAction(); String text = null; accelerator = updatedAction.getAccelerator(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); if ((accelerator != 0) && (callback != null) && (callback.isAcceleratorInUse(accelerator))) { accelerator = 0; } final String commandId = updatedAction .getActionDefinitionId(); if (("gtk".equals(SWT.getPlatform())) && (callback instanceof IBindingManagerCallback) && (commandId != null)) { final IBindingManagerCallback bindingManagerCallback = (IBindingManagerCallback) callback; final IKeyLookup lookup = KeyLookupFactory.getDefault(); final TriggerSequence[] triggerSequences = bindingManagerCallback .getActiveBindingsFor(commandId); for (int i = 0; i < triggerSequences.length; i++) { final TriggerSequence triggerSequence = triggerSequences[i]; final Trigger[] triggers = triggerSequence .getTriggers(); if (triggers.length == 1) { final Trigger trigger = triggers[0]; if (trigger instanceof KeyStroke) { final KeyStroke currentKeyStroke = (KeyStroke) trigger; final int currentNaturalKey = currentKeyStroke .getNaturalKey(); if ((currentKeyStroke.getModifierKeys() == (lookup .getCtrl() | lookup.getShift())) && ((currentNaturalKey >= '0' && currentNaturalKey <= '9') || (currentNaturalKey >= 'A' && currentNaturalKey <= 'F') || (currentNaturalKey == 'U'))) { accelerator = currentKeyStroke .getModifierKeys() | currentNaturalKey; acceleratorText = triggerSequence .format(); break; } } } } } if (accelerator == 0) { if ((callback != null) && (commandId != null)) { acceleratorText = callback .getAcceleratorText(commandId); } } else { acceleratorText = Action .convertAccelerator(accelerator); } IContributionManagerOverrides overrides = null; if (getParent() != null) { overrides = getParent().getOverrides(); } if (overrides != null) { text = getParent().getOverrides().getText(this); } mi.setAccelerator(accelerator); if (text == null) { text = updatedAction.getText(); } if (text == null) { text = ""; } else { text = Action.removeAcceleratorText(text); } if (acceleratorText == null) { mi.setText(text); } else { mi.setText(text + '\t' + acceleratorText); } } if (imageChanged) { updateImages(false); } if (enableStateChanged) { boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed(); if (mi.getEnabled() != shouldBeEnabled) { mi.setEnabled(shouldBeEnabled); } } if (checkChanged) { boolean bv = action.isChecked(); if (mi.getSelection() != bv) { mi.setSelection(bv); } } return; } if (widget instanceof Button) { Button button = (Button) widget; if (imageChanged && updateImages(false)) { textChanged = false; } if (textChanged) { String text = action.getText(); if (text == null) { text = ""; } else { text = Action.removeAcceleratorText(text); } button.setText(text); } if (tooltipTextChanged) { button.setToolTipText(action.getToolTipText()); } if (enableStateChanged) { boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed(); if (button.getEnabled() != shouldBeEnabled) { button.setEnabled(shouldBeEnabled); } } if (checkChanged) { boolean bv = action.isChecked(); if (button.getSelection() != bv) { button.setSelection(bv); } } return; } } | public final void update() { update(null); | public void update(String propertyName) { if (widget != null) { // determine what to do boolean textChanged = propertyName == null || propertyName.equals(IAction.TEXT); boolean imageChanged = propertyName == null || propertyName.equals(IAction.IMAGE); boolean tooltipTextChanged = propertyName == null || propertyName.equals(IAction.TOOL_TIP_TEXT); boolean enableStateChanged = propertyName == null || propertyName.equals(IAction.ENABLED) || propertyName .equals(IContributionManagerOverrides.P_ENABLED); boolean checkChanged = (action.getStyle() == IAction.AS_CHECK_BOX || action .getStyle() == IAction.AS_RADIO_BUTTON) && (propertyName == null || propertyName .equals(IAction.CHECKED)); if (widget instanceof ToolItem) { ToolItem ti = (ToolItem) widget; String text = action.getText(); // the set text is shown only if there is no image or if forced by MODE_FORCE_TEXT boolean showText = text != null && ((getMode() & MODE_FORCE_TEXT) != 0 || !hasImages(action)); // only do the trimming if the text will be used if (showText && text != null) { text = Action.removeAcceleratorText(text); text = Action.removeMnemonics(text); } if (textChanged) { String textToSet = showText ? text : ""; //$NON-NLS-1$ boolean rightStyle = (ti.getParent().getStyle() & SWT.RIGHT) != 0; if (rightStyle || !ti.getText().equals(textToSet)) { // In addition to being required to update the text if it // gets nulled out in the action, this is also a workaround // for bug 50151: Using SWT.RIGHT on a ToolBar leaves blank space ti.setText(textToSet); } } if (imageChanged) { // only substitute a missing image if it has no text updateImages(!showText); } if (tooltipTextChanged || textChanged) { String toolTip = action.getToolTipText(); if ((toolTip == null) || (toolTip.length() == 0)) { toolTip = text; } // if the text is showing, then only set the tooltip if // different if (!showText || toolTip != null && !toolTip.equals(text)) { ti.setToolTipText(toolTip); } else { ti.setToolTipText(null); } } if (enableStateChanged) { boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed(); if (ti.getEnabled() != shouldBeEnabled) { ti.setEnabled(shouldBeEnabled); } } if (checkChanged) { boolean bv = action.isChecked(); if (ti.getSelection() != bv) { ti.setSelection(bv); } } return; } if (widget instanceof MenuItem) { MenuItem mi = (MenuItem) widget; if (textChanged) { int accelerator = 0; String acceleratorText = null; IAction updatedAction = getAction(); String text = null; accelerator = updatedAction.getAccelerator(); ExternalActionManager.ICallback callback = ExternalActionManager .getInstance().getCallback(); // Block accelerators that are already in use. if ((accelerator != 0) && (callback != null) && (callback.isAcceleratorInUse(accelerator))) { accelerator = 0; } /* * Process accelerators on GTK in a special way to avoid Bug * 42009. We will override the native input method by * allowing these reserved accelerators to be placed on the * menu. We will only do this for "Ctrl+Shift+[0-9A-FU]". */ final String commandId = updatedAction .getActionDefinitionId(); if (("gtk".equals(SWT.getPlatform())) && (callback instanceof IBindingManagerCallback) //$NON-NLS-1$ && (commandId != null)) { final IBindingManagerCallback bindingManagerCallback = (IBindingManagerCallback) callback; final IKeyLookup lookup = KeyLookupFactory.getDefault(); final TriggerSequence[] triggerSequences = bindingManagerCallback .getActiveBindingsFor(commandId); for (int i = 0; i < triggerSequences.length; i++) { final TriggerSequence triggerSequence = triggerSequences[i]; final Trigger[] triggers = triggerSequence .getTriggers(); if (triggers.length == 1) { final Trigger trigger = triggers[0]; if (trigger instanceof KeyStroke) { final KeyStroke currentKeyStroke = (KeyStroke) trigger; final int currentNaturalKey = currentKeyStroke .getNaturalKey(); if ((currentKeyStroke.getModifierKeys() == (lookup .getCtrl() | lookup.getShift())) && ((currentNaturalKey >= '0' && currentNaturalKey <= '9') || (currentNaturalKey >= 'A' && currentNaturalKey <= 'F') || (currentNaturalKey == 'U'))) { accelerator = currentKeyStroke .getModifierKeys() | currentNaturalKey; acceleratorText = triggerSequence .format(); break; } } } } } if (accelerator == 0) { if ((callback != null) && (commandId != null)) { acceleratorText = callback .getAcceleratorText(commandId); } } else { acceleratorText = Action .convertAccelerator(accelerator); } IContributionManagerOverrides overrides = null; if (getParent() != null) { overrides = getParent().getOverrides(); } if (overrides != null) { text = getParent().getOverrides().getText(this); } mi.setAccelerator(accelerator); if (text == null) { text = updatedAction.getText(); } if (text == null) { text = ""; //$NON-NLS-1$ } else { text = Action.removeAcceleratorText(text); } if (acceleratorText == null) { mi.setText(text); } else { mi.setText(text + '\t' + acceleratorText); } } if (imageChanged) { updateImages(false); } if (enableStateChanged) { boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed(); if (mi.getEnabled() != shouldBeEnabled) { mi.setEnabled(shouldBeEnabled); } } if (checkChanged) { boolean bv = action.isChecked(); if (mi.getSelection() != bv) { mi.setSelection(bv); } } return; } if (widget instanceof Button) { Button button = (Button) widget; if (imageChanged && updateImages(false)) { textChanged = false; // don't update text if it has an image } if (textChanged) { String text = action.getText(); if (text == null) { text = ""; //$NON-NLS-1$ } else { text = Action.removeAcceleratorText(text); } button.setText(text); } if (tooltipTextChanged) { button.setToolTipText(action.getToolTipText()); } if (enableStateChanged) { boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed(); if (button.getEnabled() != shouldBeEnabled) { button.setEnabled(shouldBeEnabled); } } if (checkChanged) { boolean bv = action.isChecked(); if (button.getSelection() != bv) { button.setSelection(bv); } } return; } } } |
protected Action(String text, ImageDescriptor image) { this(); setText(text); setImageDescriptor(image); | protected Action() { | protected Action(String text, ImageDescriptor image) { this(); setText(text); setImageDescriptor(image);} |
public PartInitException(IStatus status) { super(status); | public PartInitException(String message) { super(message); | public PartInitException(IStatus status) { super(status);} |
public void add(Object parentElement, Object childElement) { add(parentElement, new Object[] { childElement }); | public void add(Object parentElement, Object[] childElements) { Assert.isNotNull(parentElement); assertElementsNotNull(childElements); Widget widget = findItem(parentElement); if (widget == null) return; Control tree = getControl(); if (widget instanceof Item) { Item ti = (Item) widget; if (!getExpanded(ti)) { boolean needDummy = isExpandable(parentElement); boolean haveDummy = false; Item[] items = getItems(ti); for (int i = 0; i < items.length; i++) { if (items[i].getData() != null) { disassociate(items[i]); items[i].dispose(); } else { if (needDummy && !haveDummy) { haveDummy = true; } else { items[i].dispose(); } } } if (needDummy && !haveDummy) { newItem(ti, SWT.NULL, -1); } else { tree.redraw(); } return; } } if (childElements.length > 0) { Object[] filtered = filter(childElements); for (int i = 0; i < filtered.length; i++) { createAddedElement(widget,filtered[i]); } } | public void add(Object parentElement, Object childElement) { add(parentElement, new Object[] { childElement }); } |
protected ChangeEvent fireChangeEvent(int changeType, Object oldValue, Object newValue, Object parent, int position) { ChangeEvent changeEvent = new ChangeEvent(this, changeType, oldValue, newValue, parent, position); if(changeListeners==null) { return changeEvent; } IChangeListener[] listeners = (IChangeListener[]) changeListeners .toArray(new IChangeListener[changeListeners.size()]); for (int i = 0; i < listeners.length; i++) { listeners[i].handleChange(changeEvent); } return changeEvent; | protected final ChangeEvent fireChangeEvent(int changeType, Object oldValue, Object newValue) { return fireChangeEvent(changeType, oldValue, newValue, ChangeEvent.POSITION_UNKNOWN); | protected ChangeEvent fireChangeEvent(int changeType, Object oldValue, Object newValue, Object parent, int position) { ChangeEvent changeEvent = new ChangeEvent(this, changeType, oldValue, newValue, parent, position); if(changeListeners==null) { // disposed return changeEvent; } IChangeListener[] listeners = (IChangeListener[]) changeListeners .toArray(new IChangeListener[changeListeners.size()]); for (int i = 0; i < listeners.length; i++) { listeners[i].handleChange(changeEvent); } return changeEvent; } |
protected void insertAfter(IContributionManager mgr, String refId, IContributionItem item) { mgr.insertAfter(refId, item); | protected void insertAfter(IContributionManager mgr, String refId, PluginAction action) { insertAfter(mgr, refId, new PluginActionContributionItem(action)); | protected void insertAfter(IContributionManager mgr, String refId, IContributionItem item) { mgr.insertAfter(refId, item); } |
public Accelerator(String id,int accelerator) { this(id,null,null,null); accelerators = new int[1][]; accelerators[0] = new int[]{accelerator}; | public Accelerator(String id, String key, String locale, String platform) { this.id = id; this.key = key; this.locale = locale; this.platform = platform; if(locale==null) this.locale = DEFAULT_LOCALE; if(platform==null) this.platform = DEFAULT_PLATFORM; | public Accelerator(String id,int accelerator) { this(id,null,null,null); accelerators = new int[1][]; accelerators[0] = new int[]{accelerator}; } |
public static KeyStroke getInstance(String string) throws ParseException { if (string == null) | public static KeyStroke getInstance(ModifierKey modifierKey, NaturalKey naturalKey) { if (modifierKey == null) | public static KeyStroke getInstance(String string) throws ParseException { if (string == null) throw new NullPointerException(); SortedSet modifierKeys = new TreeSet(); NaturalKey naturalKey = null; StringTokenizer stringTokenizer = new StringTokenizer(string, KEY_DELIMITERS, true); int i = 0; while (stringTokenizer.hasMoreTokens()) { String token = stringTokenizer.nextToken(); if (i % 2 == 0) { if (stringTokenizer.hasMoreTokens()) { token = token.toUpperCase(); ModifierKey modifierKey = (ModifierKey) ModifierKey.modifierKeysByName.get(token); if (modifierKey == null || !modifierKeys.add(modifierKey)) throw new ParseException(); } else if (token.length() == 1) { naturalKey = CharacterKey.getInstance(token.charAt(0)); break; } else { token = token.toUpperCase(); naturalKey = (NaturalKey) CharacterKey.characterKeysByName.get(token); if (naturalKey == null) naturalKey = (NaturalKey) SpecialKey.specialKeysByName.get(token); if (naturalKey == null) throw new ParseException(); } } i++; } try { return new KeyStroke(modifierKeys, naturalKey); } catch (Throwable t) { throw new ParseException(); } } |
SortedSet modifierKeys = new TreeSet(); NaturalKey naturalKey = null; StringTokenizer stringTokenizer = new StringTokenizer(string, KEY_DELIMITERS, true); int i = 0; while (stringTokenizer.hasMoreTokens()) { String token = stringTokenizer.nextToken(); if (i % 2 == 0) { if (stringTokenizer.hasMoreTokens()) { token = token.toUpperCase(); ModifierKey modifierKey = (ModifierKey) ModifierKey.modifierKeysByName.get(token); if (modifierKey == null || !modifierKeys.add(modifierKey)) throw new ParseException(); } else if (token.length() == 1) { naturalKey = CharacterKey.getInstance(token.charAt(0)); break; } else { token = token.toUpperCase(); naturalKey = (NaturalKey) CharacterKey.characterKeysByName.get(token); if (naturalKey == null) naturalKey = (NaturalKey) SpecialKey.specialKeysByName.get(token); if (naturalKey == null) throw new ParseException(); } } i++; } try { return new KeyStroke(modifierKeys, naturalKey); } catch (Throwable t) { throw new ParseException(); } | return new KeyStroke(new TreeSet(Collections.singletonList(modifierKey)), naturalKey); | public static KeyStroke getInstance(String string) throws ParseException { if (string == null) throw new NullPointerException(); SortedSet modifierKeys = new TreeSet(); NaturalKey naturalKey = null; StringTokenizer stringTokenizer = new StringTokenizer(string, KEY_DELIMITERS, true); int i = 0; while (stringTokenizer.hasMoreTokens()) { String token = stringTokenizer.nextToken(); if (i % 2 == 0) { if (stringTokenizer.hasMoreTokens()) { token = token.toUpperCase(); ModifierKey modifierKey = (ModifierKey) ModifierKey.modifierKeysByName.get(token); if (modifierKey == null || !modifierKeys.add(modifierKey)) throw new ParseException(); } else if (token.length() == 1) { naturalKey = CharacterKey.getInstance(token.charAt(0)); break; } else { token = token.toUpperCase(); naturalKey = (NaturalKey) CharacterKey.characterKeysByName.get(token); if (naturalKey == null) naturalKey = (NaturalKey) SpecialKey.specialKeysByName.get(token); if (naturalKey == null) throw new ParseException(); } } i++; } try { return new KeyStroke(modifierKeys, naturalKey); } catch (Throwable t) { throw new ParseException(); } } |
public ImportResourcesAction(IWorkbench workbench) { this(workbench.getActiveWorkbenchWindow()); | public ImportResourcesAction(IWorkbenchWindow window) { super(WorkbenchMessages.ImportResourcesAction_text); if (window == null) { throw new IllegalArgumentException(); } this.workbenchWindow = window; tracker = new PerspectiveTracker(window, this); setActionDefinitionId("org.eclipse.ui.file.import"); setToolTipText(WorkbenchMessages.ImportResourcesAction_toolTip); setId("import"); window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.IMPORT_ACTION); workbenchWindow.getSelectionService().addSelectionListener( selectionListener); setImageDescriptor(WorkbenchImages .getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_IMPORT_WIZ)); | public ImportResourcesAction(IWorkbench workbench) { this(workbench.getActiveWorkbenchWindow()); } |
public ExportResourcesAction(IWorkbench workbench) { this(workbench.getActiveWorkbenchWindow()); | public ExportResourcesAction(IWorkbenchWindow window) { this(window, WorkbenchMessages.ExportResourcesAction_text); | public ExportResourcesAction(IWorkbench workbench) { this(workbench.getActiveWorkbenchWindow()); } |
protected abstract void readINIFile(URL iniURL, URL propertiesURL) throws CoreException; | public void readINIFile() throws CoreException { IPlatformConfiguration conf = BootLoader.getCurrentPlatformConfiguration(); String configName = conf.getPrimaryFeatureIdentifier(); if (configName == null) { reportINIFailure(null, "Unknown configuration identifier"); return; } IPluginRegistry reg = Platform.getPluginRegistry(); if (reg == null) { reportINIFailure(null, "Plugin registry is null"); return; } int index = configName.lastIndexOf("_"); if (index == -1) this.desc = reg.getPluginDescriptor(configName); else { String mainPluginName = configName.substring(0, index); PluginVersionIdentifier mainPluginVersion = null; try { mainPluginVersion = new PluginVersionIdentifier(configName.substring(index + 1)); } catch (Exception e) { reportINIFailure(e, "Unknown plugin version " + configName); return; } this.desc = reg.getPluginDescriptor(mainPluginName, mainPluginVersion); } if (this.desc == null) { reportINIFailure(null, "Missing plugin descriptor for " + configName); return; } this.baseURL = desc.getInstallURL(); URL iniURL = null; try { iniURL = desc.getPlugin().find(new Path(iniFilename)); if (iniURL != null) iniURL = Platform.resolve(iniURL); } catch (CoreException e) { } catch (IOException e) { } if (iniURL == null) { reportINIFailure(null, "Unable to load plugin file: " + iniFilename); return; } URL propertiesURL = null; try { propertiesURL = desc.getPlugin().find(new Path(propertiesFilename)); if (propertiesURL != null) propertiesURL = Platform.resolve(propertiesURL); } catch (CoreException e) { reportINIFailure(null, "Unable to load plugin file: " + propertiesFilename); } catch (IOException e) { reportINIFailure(null, "Unable to load plugin file: " + propertiesFilename); } readINIFile(iniURL, propertiesURL); } | protected abstract void readINIFile(URL iniURL, URL propertiesURL) throws CoreException; |
public ActionExpression(String expressionType, String expressionValue) { if (expressionType.equals(EXP_TYPE_OBJECT_CLASS)) { root = new SingleExpression(new ObjectClassExpression( expressionValue)); } } | public ActionExpression(IConfigurationElement element) { try { root = new SingleExpression(element); } catch (IllegalStateException e) { e.printStackTrace(); root = null; } } | public ActionExpression(String expressionType, String expressionValue) { if (expressionType.equals(EXP_TYPE_OBJECT_CLASS)) { root = new SingleExpression(new ObjectClassExpression( expressionValue)); } } |
Object newValue, Object parent, int position) { super(source); this.oldValue = oldValue; this.changeType = changeType; this.newValue = newValue; this.parent = parent; this.position = position; | Object newValue) { this(source, changeType, oldValue, newValue, POSITION_UNKNOWN); | public ChangeEvent(Object source, int changeType, Object oldValue, Object newValue, Object parent, int position) { super(source); this.oldValue = oldValue; this.changeType = changeType; this.newValue = newValue; this.parent = parent; this.position = position; } |
public WizardFileSystemResourceExportPage1(IStructuredSelection selection) { this("fileSystemExportPage1", selection); setTitle(DataTransferMessages.getString("DataTransfer.fileSystemTitle")); setDescription(DataTransferMessages.getString("FileExport.exportLocalFileSystem")); | protected WizardFileSystemResourceExportPage1(String name, IStructuredSelection selection) { super(name, selection); | public WizardFileSystemResourceExportPage1(IStructuredSelection selection) { this("fileSystemExportPage1", selection);//$NON-NLS-1$ setTitle(DataTransferMessages.getString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$ setDescription(DataTransferMessages.getString("FileExport.exportLocalFileSystem")); //$NON-NLS-1$} |
public static String asString(Point value) { Assert.isNotNull(value); StringBuffer buffer = new StringBuffer(); buffer.append(value.x); buffer.append(','); buffer.append(value.y); return buffer.toString(); | public static String asString(double value) { return String.valueOf(value); | public static String asString(Point value) { Assert.isNotNull(value); StringBuffer buffer = new StringBuffer(); buffer.append(value.x); buffer.append(','); buffer.append(value.y); return buffer.toString();} |
public static final WorkbenchPreferenceDialog createDialogOn(final String preferencePageId, String[] displayedIds) { WorkbenchPreferenceDialog dialog = createDialogOn(null,preferencePageId); if(dialog == null) return null; if (displayedIds != null) dialog.showOnly(displayedIds); return dialog; | public static final WorkbenchPreferenceDialog createDialogOn(final String preferencePageId) { return createDialogOn(null,preferencePageId); | public static final WorkbenchPreferenceDialog createDialogOn(final String preferencePageId, String[] displayedIds) { WorkbenchPreferenceDialog dialog = createDialogOn(null,preferencePageId); if(dialog == null) return null; if (displayedIds != null) dialog.showOnly(displayedIds); return dialog; } |
public void add(int index, Object element) { wrappedList.add(index, element); fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry(index, true, element))); | public boolean add(Object element) { getterCalled(); boolean added = wrappedList.add(element); if (added) { fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry( wrappedList.size() - 1, true, element))); } return added; | public void add(int index, Object element) { wrappedList.add(index, element); fireListChange(Diffs.createListDiff(Diffs.createListDiffEntry(index, true, element))); } |
public WorkbenchPreferenceNode(String nodeId, String nodeLabel, String category, ImageDescriptor nodeImage, IWorkbenchPreferencePage preferencePage) { | public WorkbenchPreferenceNode(String nodeId, String nodeLabel, String category, ImageDescriptor nodeImage, IConfigurationElement element, IWorkbench newWorkbench) { | public WorkbenchPreferenceNode(String nodeId, String nodeLabel, String category, ImageDescriptor nodeImage, IWorkbenchPreferencePage preferencePage) { super(nodeId, nodeLabel, nodeImage, null); setPage(preferencePage);} |
setPage(preferencePage); | this.category = category; this.configurationElement = element; this.workbench = newWorkbench; | public WorkbenchPreferenceNode(String nodeId, String nodeLabel, String category, ImageDescriptor nodeImage, IWorkbenchPreferencePage preferencePage) { super(nodeId, nodeLabel, nodeImage, null); setPage(preferencePage);} |
if (appName == null) appName = getAppName(product); | if (appName == null) { appName = getAppName(product); } | public String getAppName() { if (appName == null) appName = getAppName(product); return appName; } |
if (windowImageDescriptors == null) windowImageDescriptors = getWindowImages(product); | if (windowImageDescriptors == null) { windowImageDescriptors = getWindowImages(product); } | public ImageDescriptor[] getWindowImages() { if (windowImageDescriptors == null) windowImageDescriptors = getWindowImages(product); return windowImageDescriptors; } |
public static MarkerList compute(MarkerFilter filter, IProgressMonitor mon, | public static MarkerList compute(MarkerFilter[] filters, IProgressMonitor mon, | public static MarkerList compute(MarkerFilter filter, IProgressMonitor mon, boolean ignoreExceptions) throws CoreException { return new MarkerList(filter.findMarkers(mon, ignoreExceptions)); } |
return new MarkerList(filter.findMarkers(mon, ignoreExceptions)); | Collection returnMarkers = new ArrayList(); for (int i = 0; i < filters.length; i++) { returnMarkers.addAll(filters[i].findMarkers(mon, ignoreExceptions)); } return new MarkerList(returnMarkers); | public static MarkerList compute(MarkerFilter filter, IProgressMonitor mon, boolean ignoreExceptions) throws CoreException { return new MarkerList(filter.findMarkers(mon, ignoreExceptions)); } |
public List getEnabledContentDescriptors(Object anElement, NavigatorViewerDescriptor aViewerDescriptor) { List descriptors = new ArrayList(); | public Set getEnabledContentDescriptors(Object anElement) { Set descriptors = new HashSet(); | public List getEnabledContentDescriptors(Object anElement, NavigatorViewerDescriptor aViewerDescriptor) { List descriptors = new ArrayList(); /* Find other ContentProviders which enable for this object */ for (Iterator contentDescriptorsItr = contentDescriptors.values().iterator(); contentDescriptorsItr.hasNext();) { NavigatorContentDescriptor descriptor = (NavigatorContentDescriptor) contentDescriptorsItr.next(); if (NAVIGATOR_ACTIVATION_SERVICE.isNavigatorExtensionActive(aViewerDescriptor.getViewerId(), descriptor.getId()) && !aViewerDescriptor.filtersContentDescriptor(descriptor)) { if (descriptor.isEnabledFor(anElement)) descriptors.add(descriptor); } } Collections.sort(descriptors, EXTENSION_COMPARATOR); return Collections.unmodifiableList(descriptors); } |
if (NAVIGATOR_ACTIVATION_SERVICE.isNavigatorExtensionActive(aViewerDescriptor.getViewerId(), descriptor.getId()) && !aViewerDescriptor.filtersContentDescriptor(descriptor)) { if (descriptor.isEnabledFor(anElement)) descriptors.add(descriptor); } | if (descriptor.isEnabledFor(anElement)) descriptors.add(descriptor); | public List getEnabledContentDescriptors(Object anElement, NavigatorViewerDescriptor aViewerDescriptor) { List descriptors = new ArrayList(); /* Find other ContentProviders which enable for this object */ for (Iterator contentDescriptorsItr = contentDescriptors.values().iterator(); contentDescriptorsItr.hasNext();) { NavigatorContentDescriptor descriptor = (NavigatorContentDescriptor) contentDescriptorsItr.next(); if (NAVIGATOR_ACTIVATION_SERVICE.isNavigatorExtensionActive(aViewerDescriptor.getViewerId(), descriptor.getId()) && !aViewerDescriptor.filtersContentDescriptor(descriptor)) { if (descriptor.isEnabledFor(anElement)) descriptors.add(descriptor); } } Collections.sort(descriptors, EXTENSION_COMPARATOR); return Collections.unmodifiableList(descriptors); } |
Collections.sort(descriptors, EXTENSION_COMPARATOR); | public List getEnabledContentDescriptors(Object anElement, NavigatorViewerDescriptor aViewerDescriptor) { List descriptors = new ArrayList(); /* Find other ContentProviders which enable for this object */ for (Iterator contentDescriptorsItr = contentDescriptors.values().iterator(); contentDescriptorsItr.hasNext();) { NavigatorContentDescriptor descriptor = (NavigatorContentDescriptor) contentDescriptorsItr.next(); if (NAVIGATOR_ACTIVATION_SERVICE.isNavigatorExtensionActive(aViewerDescriptor.getViewerId(), descriptor.getId()) && !aViewerDescriptor.filtersContentDescriptor(descriptor)) { if (descriptor.isEnabledFor(anElement)) descriptors.add(descriptor); } } Collections.sort(descriptors, EXTENSION_COMPARATOR); return Collections.unmodifiableList(descriptors); } |
|
return Collections.unmodifiableList(descriptors); | return descriptors; | public List getEnabledContentDescriptors(Object anElement, NavigatorViewerDescriptor aViewerDescriptor) { List descriptors = new ArrayList(); /* Find other ContentProviders which enable for this object */ for (Iterator contentDescriptorsItr = contentDescriptors.values().iterator(); contentDescriptorsItr.hasNext();) { NavigatorContentDescriptor descriptor = (NavigatorContentDescriptor) contentDescriptorsItr.next(); if (NAVIGATOR_ACTIVATION_SERVICE.isNavigatorExtensionActive(aViewerDescriptor.getViewerId(), descriptor.getId()) && !aViewerDescriptor.filtersContentDescriptor(descriptor)) { if (descriptor.isEnabledFor(anElement)) descriptors.add(descriptor); } } Collections.sort(descriptors, EXTENSION_COMPARATOR); return Collections.unmodifiableList(descriptors); } |
public void applyFontsAndColors(TableTreeItem control) { | public void applyFontsAndColors(TableItem control) { | public void applyFontsAndColors(TableTreeItem control) { if(colorProvider == null){ if(usedDecorators){ //If there is no provider only apply set values if(background != null) control.setBackground(background); if(foreground != null) control.setForeground(foreground); } } else{ //Always set the value if there is a provider control.setBackground(background); control.setForeground(foreground); } if(fontProvider == null){ if(usedDecorators && font != null) control.setFont(font); } else//Always set the value if there is a provider control.setFont(font); clear(); } |
public DynamicHelpAction(IWorkbenchWindow window) { if (window == null) { throw new IllegalArgumentException(); } this.workbenchWindow = window; setActionDefinitionId("org.eclipse.ui.help.dynamicHelp"); String overrideText = PrefUtil.getAPIPreferenceStore().getString( IWorkbenchPreferenceConstants.DYNAMIC_HELP_ACTION_TEXT); if ("".equals(overrideText)) { setText(appendAccelerator(WorkbenchMessages.DynamicHelpAction_text)); setToolTipText(WorkbenchMessages.DynamicHelpAction_toolTip); } else { setText(appendAccelerator(overrideText)); setToolTipText(Action.removeMnemonics(overrideText)); } window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.DYNAMIC_HELP_ACTION); | public DynamicHelpAction() { this(PlatformUI.getWorkbench().getActiveWorkbenchWindow()); | public DynamicHelpAction(IWorkbenchWindow window) { if (window == null) { throw new IllegalArgumentException(); } this.workbenchWindow = window; setActionDefinitionId("org.eclipse.ui.help.dynamicHelp"); //$NON-NLS-1$ // support for allowing a product to override the text for the action String overrideText = PrefUtil.getAPIPreferenceStore().getString( IWorkbenchPreferenceConstants.DYNAMIC_HELP_ACTION_TEXT); if ("".equals(overrideText)) { //$NON-NLS-1$ setText(appendAccelerator(WorkbenchMessages.DynamicHelpAction_text)); setToolTipText(WorkbenchMessages.DynamicHelpAction_toolTip); } else { setText(appendAccelerator(overrideText)); setToolTipText(Action.removeMnemonics(overrideText)); } window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.DYNAMIC_HELP_ACTION); } |
} else { throw e; | private List findMarkers(IResource[] resources, int depth, int limit, IProgressMonitor mon, boolean ignoreExceptions) throws CoreException { if (resources == null) { return Collections.EMPTY_LIST; } List resultList = new ArrayList(resources.length * 2); // Optimization: if a type appears in the selectedTypes list along with // all of its // subtypes, then combine these in a single search. // List of types that haven't been replaced by one of their supertypes HashSet typesToSearch = new HashSet(selectedTypes.size()); // List of types that appeared in selectedTypes along with all of their // subtypes HashSet includeAllSubtypes = new HashSet(selectedTypes.size()); typesToSearch.addAll(selectedTypes); Iterator iter = selectedTypes.iterator(); while (iter.hasNext()) { MarkerType type = (MarkerType) iter.next(); Collection subtypes = Arrays.asList(type.getAllSubTypes()); if (selectedTypes.containsAll(subtypes)) { typesToSearch.removeAll(subtypes); includeAllSubtypes.add(type); } } mon.beginTask(MarkerMessages.MarkerFilter_searching, typesToSearch .size() * resources.length); // Use this hash set to determine if there are any resources in the // list that appear along with their parent. HashSet resourcesToSearch = new HashSet(); // Insert all the resources into the hashset for (int idx = 0; idx < resources.length; idx++) { IResource next = resources[idx]; if (!next.exists()) { continue; } if (resourcesToSearch.contains(next)) { mon.worked(typesToSearch.size()); } else { resourcesToSearch.add(next); } } // Iterate through all the selected resources for (int resourceIdx = 0; resourceIdx < resources.length; resourceIdx++) { iter = typesToSearch.iterator(); IResource resource = resources[resourceIdx]; // Skip resources that don't exist if (!resource.isAccessible()) { continue; } if (depth == IResource.DEPTH_INFINITE) { // Determine if any parent of this resource is also in our // filter IResource parent = resource.getParent(); boolean found = false; while (parent != null) { if (resourcesToSearch.contains(parent)) { found = true; } parent = parent.getParent(); } // If a parent of this resource is also in the filter, we can // skip it // because we'll pick up its markers when we search the parent. if (found) { continue; } } // Iterate through all the marker types while (iter.hasNext()) { MarkerType markerType = (MarkerType) iter.next(); // Only search for subtypes of the marker if we found all of its // subtypes in the filter criteria. IMarker[] markers = resource.findMarkers(markerType.getId(), includeAllSubtypes.contains(markerType), depth); mon.worked(1); for (int idx = 0; idx < markers.length; idx++) { ConcreteMarker marker; try { marker = MarkerList.createMarker(markers[idx]); } catch (CoreException e) { if (ignoreExceptions) { continue; } else { throw e; } } if (limit != -1 && resultList.size() >= limit) { return resultList; } if (selectMarker(marker)) { resultList.add(marker); } } } } mon.done(); return resultList; } |
|
throw e; | private List findMarkers(IResource[] resources, int depth, int limit, IProgressMonitor mon, boolean ignoreExceptions) throws CoreException { if (resources == null) { return Collections.EMPTY_LIST; } List resultList = new ArrayList(resources.length * 2); // Optimization: if a type appears in the selectedTypes list along with // all of its // subtypes, then combine these in a single search. // List of types that haven't been replaced by one of their supertypes HashSet typesToSearch = new HashSet(selectedTypes.size()); // List of types that appeared in selectedTypes along with all of their // subtypes HashSet includeAllSubtypes = new HashSet(selectedTypes.size()); typesToSearch.addAll(selectedTypes); Iterator iter = selectedTypes.iterator(); while (iter.hasNext()) { MarkerType type = (MarkerType) iter.next(); Collection subtypes = Arrays.asList(type.getAllSubTypes()); if (selectedTypes.containsAll(subtypes)) { typesToSearch.removeAll(subtypes); includeAllSubtypes.add(type); } } mon.beginTask(MarkerMessages.MarkerFilter_searching, typesToSearch .size() * resources.length); // Use this hash set to determine if there are any resources in the // list that appear along with their parent. HashSet resourcesToSearch = new HashSet(); // Insert all the resources into the hashset for (int idx = 0; idx < resources.length; idx++) { IResource next = resources[idx]; if (!next.exists()) { continue; } if (resourcesToSearch.contains(next)) { mon.worked(typesToSearch.size()); } else { resourcesToSearch.add(next); } } // Iterate through all the selected resources for (int resourceIdx = 0; resourceIdx < resources.length; resourceIdx++) { iter = typesToSearch.iterator(); IResource resource = resources[resourceIdx]; // Skip resources that don't exist if (!resource.isAccessible()) { continue; } if (depth == IResource.DEPTH_INFINITE) { // Determine if any parent of this resource is also in our // filter IResource parent = resource.getParent(); boolean found = false; while (parent != null) { if (resourcesToSearch.contains(parent)) { found = true; } parent = parent.getParent(); } // If a parent of this resource is also in the filter, we can // skip it // because we'll pick up its markers when we search the parent. if (found) { continue; } } // Iterate through all the marker types while (iter.hasNext()) { MarkerType markerType = (MarkerType) iter.next(); // Only search for subtypes of the marker if we found all of its // subtypes in the filter criteria. IMarker[] markers = resource.findMarkers(markerType.getId(), includeAllSubtypes.contains(markerType), depth); mon.worked(1); for (int idx = 0; idx < markers.length; idx++) { ConcreteMarker marker; try { marker = MarkerList.createMarker(markers[idx]); } catch (CoreException e) { if (ignoreExceptions) { continue; } else { throw e; } } if (limit != -1 && resultList.size() >= limit) { return resultList; } if (selectMarker(marker)) { resultList.add(marker); } } } } mon.done(); return resultList; } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.