1 11 package org.eclipse.pde.internal.core.feature; 12 13 import java.io.PrintWriter ; 14 import java.util.ArrayList ; 15 import java.util.List ; 16 import java.util.Locale ; 17 import java.util.Vector ; 18 19 import org.eclipse.core.runtime.CoreException; 20 import org.eclipse.pde.core.IModelChangedEvent; 21 import org.eclipse.pde.core.plugin.IPluginBase; 22 import org.eclipse.pde.core.plugin.IPluginImport; 23 import org.eclipse.pde.core.plugin.IPluginModelBase; 24 import org.eclipse.pde.core.plugin.PluginRegistry; 25 import org.eclipse.pde.internal.core.ifeature.IFeature; 26 import org.eclipse.pde.internal.core.ifeature.IFeatureChild; 27 import org.eclipse.pde.internal.core.ifeature.IFeatureData; 28 import org.eclipse.pde.internal.core.ifeature.IFeatureImport; 29 import org.eclipse.pde.internal.core.ifeature.IFeatureInfo; 30 import org.eclipse.pde.internal.core.ifeature.IFeatureInstallHandler; 31 import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin; 32 import org.eclipse.pde.internal.core.ifeature.IFeatureURL; 33 import org.eclipse.pde.internal.core.util.VersionUtil; 34 import org.w3c.dom.Node ; 35 import org.w3c.dom.NodeList ; 36 37 public class Feature extends VersionableObject implements IFeature { 38 private static final long serialVersionUID = 1L; 39 final static String INDENT = " "; private String fProviderName; 41 private IFeatureURL fUrl; 42 private IFeatureInfo[] fInfos = new IFeatureInfo[3]; 43 private Vector fData = new Vector (); 44 private Vector fChildren = new Vector (); 45 private Vector fPlugins = new Vector (); 46 private Vector fImports = new Vector (); 47 private String fOs; 48 private String fWs; 49 private String fNl; 50 private String fArch; 51 private String fImageName; 52 private IFeatureInstallHandler fHandler; 53 private boolean fPrimary; 54 private boolean fExclusive; 55 private String fColocationAffinity; 56 private String fApplication; 57 private String fPlugin; 58 private boolean fValid; 59 private String fCopyright; 60 61 public void addPlugins(IFeaturePlugin[] newPlugins) throws CoreException { 62 ensureModelEditable(); 63 for (int i = 0; i < newPlugins.length; i++) { 64 fPlugins.add(newPlugins[i]); 65 ((FeaturePlugin) newPlugins[i]).setInTheModel(true); 66 } 67 fireStructureChanged(newPlugins, IModelChangedEvent.INSERT); 68 } 69 70 public void addData(IFeatureData[] newData) throws CoreException { 71 ensureModelEditable(); 72 for (int i = 0; i < newData.length; i++) { 73 fData.add(newData[i]); 74 ((FeatureData) newData[i]).setInTheModel(true); 75 } 76 fireStructureChanged(newData, IModelChangedEvent.INSERT); 77 } 78 79 public void addIncludedFeatures(IFeatureChild[] features) 80 throws CoreException { 81 ensureModelEditable(); 82 for (int i = 0; i < features.length; i++) { 83 fChildren.add(features[i]); 84 ((FeatureChild) features[i]).setInTheModel(true); 85 } 86 fireStructureChanged(features, IModelChangedEvent.INSERT); 87 } 88 89 public void addImports(IFeatureImport[] iimports) throws CoreException { 90 ensureModelEditable(); 91 for (int i = 0; i < iimports.length; i++) { 92 fImports.add(iimports[i]); 93 ((FeatureImport) iimports[i]).setInTheModel(true); 94 } 95 fireStructureChanged(iimports, IModelChangedEvent.INSERT); 96 } 97 98 public IFeaturePlugin[] getPlugins() { 99 IFeaturePlugin[] result = new IFeaturePlugin[fPlugins.size()]; 100 fPlugins.copyInto(result); 101 return result; 102 } 103 104 public IFeatureData[] getData() { 105 IFeatureData[] result = new IFeatureData[fData.size()]; 106 fData.copyInto(result); 107 return result; 108 } 109 110 public IFeatureChild[] getIncludedFeatures() { 111 IFeatureChild[] result = new IFeatureChild[fChildren.size()]; 112 fChildren.copyInto(result); 113 return result; 114 } 115 public IFeatureImport[] getImports() { 116 IFeatureImport[] result = new IFeatureImport[fImports.size()]; 117 fImports.copyInto(result); 118 return result; 119 } 120 public String getProviderName() { 121 return fProviderName; 122 } 123 124 public String getPlugin() { 125 return fPlugin; 126 } 127 128 public IPluginModelBase getReferencedModel(IFeaturePlugin reference) { 129 IPluginModelBase model = PluginRegistry.findModel(reference.getId()); 130 return (model != null && model.isEnabled()) ? model : null; 131 } 132 public IFeatureURL getURL() { 133 return fUrl; 134 } 135 public IFeatureInstallHandler getInstallHandler() { 136 return fHandler; 137 } 138 139 public IFeatureInfo getFeatureInfo(int index) { 140 return fInfos[index]; 141 } 142 143 public boolean isPrimary() { 144 return fPrimary; 145 } 146 147 public boolean isExclusive() { 148 return fExclusive; 149 } 150 151 protected void parse(Node node) { 152 super.parse(node); 153 fProviderName = getNodeAttribute(node, "provider-name"); fPlugin = getNodeAttribute(node, "plugin"); fOs = getNodeAttribute(node, "os"); fWs = getNodeAttribute(node, "ws"); fNl = getNodeAttribute(node, "nl"); fArch = getNodeAttribute(node, "arch"); fImageName = getNodeAttribute(node, "image"); fColocationAffinity = getNodeAttribute(node, "colocation-affinity"); fApplication = getNodeAttribute(node, "application"); fPrimary = getBooleanAttribute(node, "primary"); fExclusive = getBooleanAttribute(node, "exclusive"); NodeList children = node.getChildNodes(); 165 fValid = true; 166 167 for (int i = 0; i < children.getLength(); i++) { 168 Node child = children.item(i); 169 if (child.getNodeType() == Node.ELEMENT_NODE) { 170 String tag = child.getNodeName().toLowerCase(Locale.ENGLISH); 171 if (tag.equals("description")) { IFeatureInfo info = getModel().getFactory().createInfo( 173 IFeature.INFO_DESCRIPTION); 174 ((FeatureInfo) info).setInTheModel(true); 175 ((FeatureInfo) info).parse(child); 176 fInfos[IFeature.INFO_DESCRIPTION] = info; 177 } else if (tag.equals("license")) { IFeatureInfo info = getModel().getFactory().createInfo( 179 IFeature.INFO_LICENSE); 180 ((FeatureInfo) info).setInTheModel(true); 181 ((FeatureInfo) info).parse(child); 182 fInfos[IFeature.INFO_LICENSE] = info; 183 } else if (tag.equals("copyright")) { IFeatureInfo info = getModel().getFactory().createInfo( 185 IFeature.INFO_COPYRIGHT); 186 ((FeatureInfo) info).setInTheModel(true); 187 ((FeatureInfo) info).parse(child); 188 fInfos[IFeature.INFO_COPYRIGHT] = info; 189 } else if (tag.equals("url")) { if (fUrl == null) { 191 fUrl = getModel().getFactory().createURL(); 192 ((FeatureURL) fUrl).setInTheModel(true); 193 ((FeatureURL) fUrl).parse(child); 194 } 195 } else if (tag.equals("requires")) { parseRequires(child); 197 } else if (tag.equals("install-handler")) { IFeatureInstallHandler handler = getModel().getFactory() 199 .createInstallHandler(); 200 ((FeatureInstallHandler) handler).parse(child); 201 ((FeatureInstallHandler) handler).setInTheModel(true); 202 this.fHandler = handler; 203 } else if (tag.equals("plugin")) { IFeaturePlugin plugin = getModel().getFactory() 205 .createPlugin(); 206 ((FeaturePlugin) plugin).parse(child); 207 ((FeaturePlugin) plugin).setInTheModel(true); 208 fPlugins.add(plugin); 209 } else if (tag.equals("data")) { IFeatureData newData = getModel().getFactory().createData(); 211 ((FeatureData) newData).parse(child); 212 ((FeatureData) newData).setInTheModel(true); 213 fData.add(newData); 214 } else if (tag.equals("includes")) { IFeatureChild newChild = getModel().getFactory() 216 .createChild(); 217 ((FeatureChild) newChild).parse(child); 218 ((FeatureChild) newChild).setInTheModel(true); 219 this.fChildren.add(newChild); 220 } 221 } 222 } 223 fValid = hasRequiredAttributes(); 224 } 225 private void parseRequires(Node node) { 226 NodeList children = node.getChildNodes(); 227 for (int i = 0; i < children.getLength(); i++) { 228 Node child = children.item(i); 229 if (child.getNodeType() == Node.ELEMENT_NODE) { 230 if (child.getNodeName().equalsIgnoreCase("import")) { IFeatureImport iimport = getModel().getFactory() 232 .createImport(); 233 ((FeatureImport) iimport).parse(child); 234 ((FeatureImport) iimport).setInTheModel(true); 235 fImports.add(iimport); 236 } 237 } 238 } 239 } 240 241 public void computeImports() throws CoreException { 242 Vector preservedImports = new Vector (fImports.size()); 244 ArrayList newImports = new ArrayList (); 246 for (int i = 0; i < fPlugins.size(); i++) { 247 IFeaturePlugin fp = (IFeaturePlugin) fPlugins.get(i); 248 IPluginModelBase model = PluginRegistry.findModel(fp.getId()); 249 if (model != null) { 250 addPluginImports(preservedImports, newImports, model.getPluginBase()); 251 } 252 } 253 for (int i = 0; i < fImports.size(); i++) { 255 IFeatureImport iimport = (IFeatureImport) fImports.get(i); 256 if (iimport.getType() == IFeatureImport.FEATURE) 257 preservedImports.add(iimport); 258 } 259 Vector removedImports = ((Vector ) fImports.clone()); 261 removedImports.removeAll(preservedImports); 262 fImports = preservedImports; 264 if (removedImports.size() > 0) { 265 fireStructureChanged((IFeatureImport[]) removedImports 266 .toArray(new IFeatureImport[removedImports.size()]), 267 IModelChangedEvent.REMOVE); 268 } 269 if (newImports.size() > 0) { 271 fImports.addAll(newImports); 272 fireStructureChanged((IFeatureImport[]) newImports 273 .toArray(new IFeatureImport[newImports.size()]), 274 IModelChangedEvent.INSERT); 275 } 276 } 277 278 289 private void addPluginImports(List preservedImports, List newImports, 290 IPluginBase plugin) throws CoreException { 291 IPluginImport[] pluginImports = plugin.getImports(); 292 for (int i = 0; i < pluginImports.length; i++) { 293 IPluginImport pluginImport = pluginImports[i]; 294 if (pluginImport.isOptional()) { 295 continue; 296 } 297 String id = pluginImport.getId(); 298 String version = pluginImport.getVersion(); 299 int match = pluginImport.getMatch(); 300 if (findFeaturePlugin(id, version, match) != null) { 301 continue; 303 } 304 if (findImport(preservedImports, id, version, match) != null) { 305 continue; 307 } 308 if (findImport(newImports, id, version, match) != null) { 309 continue; 311 } 312 IFeatureImport iimport = findImport(fImports, id, version, match); 313 if (iimport != null) { 314 preservedImports.add(iimport); 316 continue; 317 } 318 iimport = getModel().getFactory().createImport(); 320 iimport.setId(id); 321 iimport.setVersion(version); 322 iimport.setMatch(match); 323 ((FeatureImport) iimport).setInTheModel(true); 324 newImports.add(iimport); 325 } 326 } 327 328 336 private IFeatureImport findImport(List imports, String id, String version, int match) { 337 for (int i = 0; i < imports.size(); i++) { 338 IFeatureImport iimport = (IFeatureImport) imports.get(i); 339 if (iimport.getId().equals(id)) { 340 if (version == null) 341 return iimport; 342 if (version.equals(iimport.getVersion()) 343 && match == iimport.getMatch()) 344 return iimport; 345 } 346 } 347 return null; 348 } 349 350 private IFeaturePlugin findFeaturePlugin(String id, String version, 351 int match) { 352 353 for (int i = 0; i < fPlugins.size(); i++) { 354 IFeaturePlugin fp = (IFeaturePlugin) fPlugins.get(i); 355 String pid = fp.getId(); 356 String pversion = fp.getVersion(); 357 if (VersionUtil.compare(id, version, pid, pversion, match)) 358 return fp; 359 } 360 return null; 361 } 362 363 public void removePlugins(IFeaturePlugin[] removed) throws CoreException { 364 ensureModelEditable(); 365 for (int i = 0; i < removed.length; i++) { 366 fPlugins.remove(removed[i]); 367 ((FeaturePlugin) removed[i]).setInTheModel(false); 368 } 369 fireStructureChanged(removed, IModelChangedEvent.REMOVE); 370 } 371 372 public void removeData(IFeatureData[] removed) throws CoreException { 373 ensureModelEditable(); 374 for (int i = 0; i < removed.length; i++) { 375 fData.remove(removed[i]); 376 ((FeatureData) removed[i]).setInTheModel(false); 377 } 378 fireStructureChanged(removed, IModelChangedEvent.REMOVE); 379 } 380 381 public void removeIncludedFeatures(IFeatureChild[] features) 382 throws CoreException { 383 ensureModelEditable(); 384 for (int i = 0; i < features.length; i++) { 385 fChildren.remove(features[i]); 386 ((FeatureChild) features[i]).setInTheModel(false); 387 } 388 fireStructureChanged(features, IModelChangedEvent.REMOVE); 389 } 390 public void removeImports(IFeatureImport[] iimports) throws CoreException { 391 ensureModelEditable(); 392 for (int i = 0; i < iimports.length; i++) { 393 fImports.remove(iimports[i]); 394 ((FeatureImport) iimports[i]).setInTheModel(false); 395 } 396 fireStructureChanged(iimports, IModelChangedEvent.REMOVE); 397 } 398 399 public String getOS() { 400 return fOs; 401 } 402 403 public String getWS() { 404 return fWs; 405 } 406 407 public String getNL() { 408 return fNl; 409 } 410 411 public String getArch() { 412 return fArch; 413 } 414 415 public String getColocationAffinity() { 416 return fColocationAffinity; 417 } 418 419 public String getApplication() { 420 return fApplication; 421 } 422 423 public void setOS(String os) throws CoreException { 424 ensureModelEditable(); 425 Object oldValue = this.fOs; 426 this.fOs = os; 427 firePropertyChanged(P_OS, oldValue, os); 428 } 429 public void setWS(String ws) throws CoreException { 430 ensureModelEditable(); 431 Object oldValue = this.fWs; 432 this.fWs = ws; 433 firePropertyChanged(P_WS, oldValue, ws); 434 } 435 public void setNL(String nl) throws CoreException { 436 ensureModelEditable(); 437 Object oldValue = this.fNl; 438 this.fNl = nl; 439 firePropertyChanged(P_NL, oldValue, nl); 440 } 441 public void setArch(String arch) throws CoreException { 442 ensureModelEditable(); 443 Object oldValue = this.fArch; 444 this.fArch = arch; 445 firePropertyChanged(P_ARCH, oldValue, arch); 446 } 447 448 public void setPrimary(boolean newValue) throws CoreException { 449 if (this.fPrimary == newValue) 450 return; 451 ensureModelEditable(); 452 Boolean oldValue = this.fPrimary ? Boolean.TRUE : Boolean.FALSE; 453 this.fPrimary = newValue; 454 firePropertyChanged(P_PRIMARY, oldValue, newValue 455 ? Boolean.TRUE 456 : Boolean.FALSE); 457 } 458 459 public void setExclusive(boolean newValue) throws CoreException { 460 if (this.fExclusive == newValue) 461 return; 462 ensureModelEditable(); 463 Boolean oldValue = this.fExclusive ? Boolean.TRUE : Boolean.FALSE; 464 this.fExclusive = newValue; 465 firePropertyChanged(P_EXCLUSIVE, oldValue, newValue 466 ? Boolean.TRUE 467 : Boolean.FALSE); 468 } 469 470 public void setColocationAffinity(String newValue) throws CoreException { 471 ensureModelEditable(); 472 Object oldValue = this.fColocationAffinity; 473 this.fColocationAffinity = newValue; 474 firePropertyChanged(P_COLLOCATION_AFFINITY, oldValue, newValue); 475 } 476 477 public void setApplication(String newValue) throws CoreException { 478 ensureModelEditable(); 479 Object oldValue = this.fApplication; 480 this.fApplication = newValue; 481 firePropertyChanged(P_APPLICATION, oldValue, newValue); 482 } 483 484 public void setProviderName(String providerName) throws CoreException { 485 ensureModelEditable(); 486 Object oldValue = this.fProviderName; 487 this.fProviderName = providerName; 488 firePropertyChanged(P_PROVIDER, oldValue, providerName); 489 } 490 491 public void setPlugin(String plugin) throws CoreException { 492 ensureModelEditable(); 493 Object oldValue = this.fPlugin; 494 this.fPlugin = plugin; 495 firePropertyChanged(P_PLUGIN, oldValue, plugin); 496 } 497 public void setURL(IFeatureURL url) throws CoreException { 498 ensureModelEditable(); 499 Object oldValue = this.fUrl; 500 if (this.fUrl != null) { 501 ((FeatureURL) this.fUrl).setInTheModel(false); 502 } 503 this.fUrl = url; 504 firePropertyChanged(P_URL, oldValue, url); 505 } 506 public void setInstallHandler(IFeatureInstallHandler handler) 507 throws CoreException { 508 ensureModelEditable(); 509 Object oldValue = this.fHandler; 510 if (this.fHandler != null) { 511 ((FeatureInstallHandler) this.fHandler).setInTheModel(false); 512 } 513 this.fHandler = handler; 514 firePropertyChanged(P_INSTALL_HANDLER, oldValue, handler); 515 } 516 517 public void setFeatureInfo(IFeatureInfo info, int index) 518 throws CoreException { 519 ensureModelEditable(); 520 Object oldValue = fInfos[index]; 521 if (oldValue != null) { 522 ((FeatureInfo) oldValue).setInTheModel(true); 523 } 524 fInfos[index] = info; 525 String property; 526 switch (index) { 527 case INFO_DESCRIPTION : 528 property = P_DESCRIPTION; 529 break; 530 case INFO_LICENSE : 531 property = P_LICENSE; 532 break; 533 case INFO_COPYRIGHT : 534 property = P_COPYRIGHT; 535 break; 536 default : 537 return; 538 } 539 firePropertyChanged(property, oldValue, info); 540 } 541 542 548 public void setImageName(String imageName) throws CoreException { 549 ensureModelEditable(); 550 Object oldValue = this.fImageName; 551 this.fImageName = imageName; 552 firePropertyChanged(P_IMAGE, oldValue, imageName); 553 } 554 555 public void restoreProperty(String name, Object oldValue, Object newValue) 556 throws CoreException { 557 if (name.equals(P_OS)) { 558 setOS((String ) newValue); 559 } else if (name.equals(P_WS)) { 560 setWS((String ) newValue); 561 } else if (name.equals(P_NL)) { 562 setNL((String ) newValue); 563 } else if (name.equals(P_ARCH)) { 564 setArch((String ) newValue); 565 } else if (name.equals(P_COLLOCATION_AFFINITY)) { 566 setColocationAffinity((String ) newValue); 567 } else if (name.equals(P_APPLICATION)) { 568 setApplication((String ) newValue); 569 } else if (name.equals(P_PRIMARY)) { 570 setPrimary(newValue != null 571 ? ((Boolean ) newValue).booleanValue() 572 : false); 573 } else if (name.equals(P_EXCLUSIVE)) { 574 setExclusive(newValue != null 575 ? ((Boolean ) newValue).booleanValue() 576 : false); 577 } else if (name.equals(P_PROVIDER)) { 578 setProviderName((String ) newValue); 579 } else if (name.equals(P_PLUGIN)) { 580 setPlugin((String ) newValue); 581 } else if (name.equals(P_URL)) { 582 setURL((IFeatureURL) newValue); 583 } else if (name.equals(P_INSTALL_HANDLER)) { 584 setInstallHandler((IFeatureInstallHandler) newValue); 585 } else if (name.equals(P_DESCRIPTION)) { 586 setFeatureInfo((IFeatureInfo) newValue, INFO_DESCRIPTION); 587 } else if (name.equals(P_LICENSE)) { 588 setFeatureInfo((IFeatureInfo) newValue, INFO_LICENSE); 589 } else if (name.equals(P_COPYRIGHT)) { 590 setFeatureInfo((IFeatureInfo) newValue, INFO_COPYRIGHT); 591 } else if (name.equals(P_IMAGE)) { 592 setImageName((String ) newValue); 593 } else 594 super.restoreProperty(name, oldValue, newValue); 595 } 596 597 public void reset() { 598 super.reset(); 599 fData.clear(); 600 fPlugins.clear(); 601 fImports.clear(); 602 fChildren.clear(); 603 fUrl = null; 604 fProviderName = null; 605 fPlugin = null; 606 fOs = null; 607 fWs = null; 608 fNl = null; 609 fArch = null; 610 fInfos[0] = null; 611 fInfos[1] = null; 612 fInfos[2] = null; 613 fPrimary = false; 614 fExclusive = false; 615 fColocationAffinity = null; 616 fApplication = null; 617 fValid = false; 618 } 619 620 public boolean isValid() { 621 return fValid; 622 } 623 624 private boolean hasRequiredAttributes() { 625 if (id == null) 628 return false; 629 if (version == null) 630 return false; 631 632 for (int i = 0; i < fChildren.size(); i++) { 633 IFeatureChild child = (IFeatureChild) fChildren.elementAt(i); 634 if (child.getId() == null || child.getVersion() == null) 635 return false; 636 } 637 for (int i = 0; i < fPlugins.size(); i++) { 638 IFeaturePlugin plugin = (IFeaturePlugin) fPlugins.elementAt(i); 639 if (plugin.getId() == null || plugin.getVersion() == null) 640 return false; 641 642 } 643 for (int i = 0; i < fData.size(); i++) { 644 IFeatureData entry = (IFeatureData) fData.elementAt(i); 645 if (entry.getId() == null) 646 return false; 647 } 648 for (int i = 0; i < fImports.size(); i++) { 649 IFeatureImport iimport = (IFeatureImport) fImports.elementAt(i); 650 if (iimport.getId() == null) 651 return false; 652 } 653 return true; 654 } 655 656 public void write(String indent, PrintWriter writer) { 657 if (fCopyright != null) { 658 writer.println("<!--" + fCopyright + "-->"); } 660 writer.print(indent + "<feature"); String indent2 = indent + INDENT; 662 String indenta = indent + INDENT + INDENT; 663 writeIfDefined(indenta, writer, "id", getId()); writeIfDefined(indenta, writer, "label", getWritableString(getLabel())); writeIfDefined(indenta, writer, "version", getVersion()); writeIfDefined(indenta, writer, "provider-name", getWritableString(fProviderName)); 668 writeIfDefined(indenta, writer, "plugin", getPlugin()); 670 writeIfDefined(indenta, writer, "os", fOs); writeIfDefined(indenta, writer, "ws", fWs); writeIfDefined(indenta, writer, "nl", fNl); writeIfDefined(indenta, writer, "arch", fArch); if (fImageName != null) 675 writeIfDefined(indenta, writer, 676 "image", getWritableString(fImageName)); if (isPrimary()) { 678 writer.println(); 679 writer.print(indenta + "primary=\"true\""); } 681 if (isExclusive()) { 682 writer.println(); 683 writer.print(indenta + "exclusive=\"true\""); } 685 writeIfDefined(indenta, writer, 686 "colocation-affinity", fColocationAffinity); writeIfDefined(indenta, writer, "application", fApplication); 689 writer.println(">"); if (fHandler != null) { 691 fHandler.write(indent2, writer); 692 } 693 694 for (int i = 0; i < 3; i++) { 695 IFeatureInfo info = fInfos[i]; 696 if (info != null && !info.isEmpty()) 697 info.write(indent2, writer); 698 } 699 700 if (fUrl != null) { 701 fUrl.write(indent2, writer); 702 } 703 for (int i = 0; i < fChildren.size(); i++) { 704 IFeatureChild child = (IFeatureChild) fChildren.elementAt(i); 705 writer.println(); 706 child.write(indent2, writer); 707 } 708 if (fImports.size() > 0) { 709 writer.println(); 710 writer.println(indent2 + "<requires>"); for (int i = 0; i < fImports.size(); i++) { 712 IFeatureImport iimport = (IFeatureImport) fImports.get(i); 713 iimport.write(indenta, writer); 714 } 715 writer.println(indent2 + "</requires>"); } 717 for (int i = 0; i < fPlugins.size(); i++) { 718 IFeaturePlugin plugin = (IFeaturePlugin) fPlugins.elementAt(i); 719 writer.println(); 720 plugin.write(indent2, writer); 721 } 722 for (int i = 0; i < fData.size(); i++) { 723 IFeatureData entry = (IFeatureData) fData.elementAt(i); 724 writer.println(); 725 entry.write(indent2, writer); 726 } 727 writer.println(); 728 writer.println(indent + "</feature>"); } 730 private void writeIfDefined(String indent, PrintWriter writer, 731 String attName, String attValue) { 732 if (attValue == null || attValue.trim().length() == 0) 733 return; 734 writer.println(); 735 writer.print(indent + attName + "=\"" + attValue + "\""); } 737 742 public String getImageName() { 743 return fImageName; 744 } 745 746 747 public String getCopyright() { 748 return fCopyright; 749 } 750 751 public void setCopyright(String copyright) { 752 fCopyright = copyright; 753 } 754 } 755 | Popular Tags |