1 11 package org.eclipse.pde.internal.ui.editor.plugin; 12 import java.io.File ; 13 import java.io.IOException ; 14 import java.util.Locale ; 15 import java.util.zip.ZipFile ; 16 17 import org.eclipse.core.resources.IContainer; 18 import org.eclipse.core.resources.IFile; 19 import org.eclipse.core.resources.IFolder; 20 import org.eclipse.core.resources.IProject; 21 import org.eclipse.core.resources.IResource; 22 import org.eclipse.core.resources.IStorage; 23 import org.eclipse.core.resources.ProjectScope; 24 import org.eclipse.core.runtime.CoreException; 25 import org.eclipse.core.runtime.Path; 26 import org.eclipse.core.runtime.preferences.IEclipsePreferences; 27 import org.eclipse.jface.preference.IPreferenceStore; 28 import org.eclipse.pde.core.IBaseModel; 29 import org.eclipse.pde.core.IIdentifiable; 30 import org.eclipse.pde.core.build.IBuild; 31 import org.eclipse.pde.core.build.IBuildEntry; 32 import org.eclipse.pde.core.build.IBuildModel; 33 import org.eclipse.pde.core.plugin.IFragmentModel; 34 import org.eclipse.pde.core.plugin.IPluginBase; 35 import org.eclipse.pde.core.plugin.IPluginExtension; 36 import org.eclipse.pde.core.plugin.IPluginExtensionPoint; 37 import org.eclipse.pde.core.plugin.IPluginModelBase; 38 import org.eclipse.pde.core.plugin.IPluginObject; 39 import org.eclipse.pde.core.plugin.ISharedPluginModel; 40 import org.eclipse.pde.core.plugin.PluginRegistry; 41 import org.eclipse.pde.internal.core.ICoreConstants; 42 import org.eclipse.pde.internal.core.PDECore; 43 import org.eclipse.pde.internal.core.TargetPlatformHelper; 44 import org.eclipse.pde.internal.core.build.IBuildObject; 45 import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelProvider; 46 import org.eclipse.pde.internal.core.plugin.WorkspaceFragmentModel; 47 import org.eclipse.pde.internal.core.plugin.WorkspacePluginModel; 48 import org.eclipse.pde.internal.core.plugin.WorkspacePluginModelBase; 49 import org.eclipse.pde.internal.core.util.CoreUtility; 50 import org.eclipse.pde.internal.ui.IPDEUIConstants; 51 import org.eclipse.pde.internal.ui.IPreferenceConstants; 52 import org.eclipse.pde.internal.ui.PDEPlugin; 53 import org.eclipse.pde.internal.ui.editor.ISortableContentOutlinePage; 54 import org.eclipse.pde.internal.ui.editor.JarEntryEditorInput; 55 import org.eclipse.pde.internal.ui.editor.JarEntryFile; 56 import org.eclipse.pde.internal.ui.editor.MultiSourceEditor; 57 import org.eclipse.pde.internal.ui.editor.PDEFormEditor; 58 import org.eclipse.pde.internal.ui.editor.PDESourcePage; 59 import org.eclipse.pde.internal.ui.editor.SystemFileEditorInput; 60 import org.eclipse.pde.internal.ui.editor.build.BuildInputContext; 61 import org.eclipse.pde.internal.ui.editor.build.BuildPage; 62 import org.eclipse.pde.internal.ui.editor.build.BuildSourcePage; 63 import org.eclipse.pde.internal.ui.editor.context.InputContext; 64 import org.eclipse.pde.internal.ui.editor.context.InputContextManager; 65 import org.eclipse.swt.widgets.Display; 66 import org.eclipse.ui.IEditorInput; 67 import org.eclipse.ui.IEditorPart; 68 import org.eclipse.ui.IFileEditorInput; 69 import org.eclipse.ui.IShowEditorInput; 70 import org.eclipse.ui.IStorageEditorInput; 71 import org.eclipse.ui.PartInitException; 72 import org.eclipse.ui.part.FileEditorInput; 73 import org.eclipse.ui.views.properties.IPropertySheetPage; 74 import org.osgi.service.prefs.BackingStoreException; 75 76 public class ManifestEditor extends MultiSourceEditor implements IShowEditorInput { 77 78 private static int BUILD_INDEX = 5; 79 private static boolean SHOW_SOURCE; 80 private boolean fEquinox = true; 81 private boolean fShowExtensions = true; 82 private IEclipsePreferences fPrefs; 83 84 87 protected String getEditorID() { 88 return IPDEUIConstants.MANIFEST_EDITOR_ID; 89 } 90 91 public static IEditorPart openPluginEditor(String id) { 92 return openPluginEditor(PluginRegistry.findModel(id)); 93 } 94 95 public static IEditorPart openPluginEditor(IPluginModelBase model) { 96 if (model == null) { 97 Display.getDefault().beep(); 98 return null; 99 } 100 return openPluginEditor(model, false); 101 } 102 103 public static IEditorPart openPluginEditor(IPluginModelBase model, boolean source) { 104 return open(model.getPluginBase(), source); 105 } 106 107 public static IEditorPart open(Object object, boolean source) { 108 SHOW_SOURCE = source; 109 if (object instanceof IPluginObject) { 110 ISharedPluginModel model = ((IPluginObject)object).getModel(); 111 if (model instanceof IBundlePluginModelProvider) 112 model = ((IBundlePluginModelProvider)model).getBundlePluginModel(); 113 if (model instanceof IPluginModelBase) { 114 String filename = ((IPluginModelBase)model).isFragmentModel() ? "fragment.xml" : "plugin.xml"; if (!(object instanceof IPluginExtension) && !(object instanceof IPluginExtensionPoint)) { 116 File file = new File (model.getInstallLocation()); 117 if (file.isFile()) { 118 if (CoreUtility.jarContainsResource(file, "META-INF/MANIFEST.MF", false)) { filename = "META-INF/MANIFEST.MF"; } 121 } else if (new File (file, "META-INF/MANIFEST.MF").exists()) { filename = "META-INF/MANIFEST.MF"; } 124 } 125 IResource resource = model.getUnderlyingResource(); 126 if (resource == null) 127 return openExternalPlugin(new File (model.getInstallLocation()), filename); 128 return openWorkspacePlugin(resource.getProject().getFile(filename)); 129 } 130 } 131 return null; 132 } 133 134 135 private static IEditorPart openWorkspacePlugin(IFile pluginFile) { 136 return openEditor(new FileEditorInput(pluginFile)); 137 } 138 139 private static IEditorPart openExternalPlugin(File location, String filename) { 140 IEditorInput input = null; 141 if (location.isFile()) { 142 try { 143 ZipFile zipFile = new ZipFile (location); 144 if (zipFile.getEntry(filename) != null) 145 input = new JarEntryEditorInput(new JarEntryFile(zipFile, filename)); 146 } catch (IOException e) { 147 } 148 } else { 149 File file = new File (location, filename); 150 if (file.exists()) 151 input = new SystemFileEditorInput(file); 152 } 153 return openEditor(input); 154 } 155 156 public static IEditorPart openEditor(IEditorInput input) { 157 if (input != null) { 158 try { 159 return PDEPlugin.getActivePage().openEditor( 160 input, 161 IPDEUIConstants.MANIFEST_EDITOR_ID); 162 } catch (PartInitException e) { 163 PDEPlugin.logException(e); 164 } 165 } 166 return null; 167 } 168 169 protected void createResourceContexts(InputContextManager manager, IFileEditorInput input) { 170 IFile file = input.getFile(); 171 IContainer container = file.getParent(); 172 173 IFile manifestFile = null; 174 IFile buildFile = null; 175 IFile pluginFile = null; 176 boolean fragment = false; 177 178 String name = file.getName().toLowerCase(Locale.ENGLISH); 179 if (name.equals("manifest.mf")) { if (container instanceof IFolder) 181 container = container.getParent(); 182 manifestFile = file; 183 buildFile = container.getFile(new Path("build.properties")); pluginFile = createPluginFile(container); 185 } else if (name.equals("plugin.xml") || name.equals("fragment.xml")) { pluginFile = file; 187 fragment = name.equals("fragment.xml"); buildFile = container.getFile(new Path("build.properties")); manifestFile = container.getFile(new Path("META-INF/MANIFEST.MF")); } 191 if (manifestFile.exists()) { 192 IEditorInput in = new FileEditorInput(manifestFile); 193 manager.putContext(in, new BundleInputContext(this, in, file == manifestFile)); 194 } 195 if (pluginFile.exists()) { 196 FileEditorInput in = new FileEditorInput(pluginFile); 197 manager.putContext(in, new PluginInputContext(this, in, file == pluginFile, fragment)); 198 } 199 if (buildFile.exists()) { 200 FileEditorInput in = new FileEditorInput(buildFile); 201 manager.putContext(in, new BuildInputContext(this, in, false)); 202 } 203 manager.monitorFile(manifestFile); 204 manager.monitorFile(pluginFile); manager.monitorFile(buildFile); 206 207 fPrefs = new ProjectScope(container.getProject()).getNode(PDECore.PLUGIN_ID); 208 if (fPrefs != null) { 209 fShowExtensions = fPrefs.getBoolean(ICoreConstants.EXTENSIONS_PROPERTY, true); 210 fEquinox = fPrefs.getBoolean(ICoreConstants.EQUINOX_PROPERTY, true); 211 } 212 } 213 214 protected InputContextManager createInputContextManager() { 215 PluginInputContextManager manager = new PluginInputContextManager(this); 216 manager.setUndoManager(new PluginUndoManager(this)); 217 return manager; 218 } 219 220 public void monitoredFileAdded(IFile file) { 221 if (fInputContextManager == null) 222 return; 223 String name = file.getName(); 224 if (name.equalsIgnoreCase("MANIFEST.MF")) { if (!fInputContextManager.hasContext(BundleInputContext.CONTEXT_ID)) { 226 IEditorInput in = new FileEditorInput(file); 227 fInputContextManager.putContext(in, new BundleInputContext(this, in, false)); 228 } 229 } 230 else if (name.equalsIgnoreCase("plugin.xml")) { if (!fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) { 232 IEditorInput in = new FileEditorInput(file); 233 fInputContextManager.putContext(in, new PluginInputContext(this, in, false, false)); 234 } 235 } 236 else if (name.equalsIgnoreCase("fragment.xml")) { if (!fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) { 238 IEditorInput in = new FileEditorInput(file); 239 fInputContextManager.putContext(in, new PluginInputContext(this, in, false, true)); 240 } 241 } 242 else if (name.equalsIgnoreCase("build.properties")) { if (!fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) { 244 IEditorInput in = new FileEditorInput(file); 245 fInputContextManager.putContext(in, new BuildInputContext(this, in, false)); 246 } 247 } 248 } 249 250 public void ensurePluginContextPresence() { 251 if (fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) 252 return; 253 IProject project = fInputContextManager.getCommonProject(); 254 String name = (fInputContextManager.getAggregateModel() instanceof IFragmentModel) 255 ? "fragment.xml" : "plugin.xml"; IFile file = project.getFile(name); 257 WorkspacePluginModelBase model; 258 if (name.equals("fragment.xml")) model = new WorkspaceFragmentModel(file, false); 260 else 261 model = new WorkspacePluginModel(file, false); 262 263 IPluginBase pluginBase = model.getPluginBase(true); 264 try { 265 pluginBase.setSchemaVersion(TargetPlatformHelper.getTargetVersion() < 3.2 ? "3.0" : "3.2"); } 267 catch (CoreException e) { 268 } 269 model.save(); 270 IEditorInput in = new FileEditorInput(file); 271 fInputContextManager.putContext(in, new PluginInputContext(this, in, false, false)); 272 273 updateBuildProperties(name); 274 } 275 276 private void updateBuildProperties(String filename) { 277 try { 278 InputContext context = fInputContextManager.findContext(BuildInputContext.CONTEXT_ID); 279 if (context != null) { 280 IBuildModel buildModel = (IBuildModel)context.getModel(); 281 IBuild build = buildModel.getBuild(); 282 IBuildEntry entry = build.getEntry("bin.includes"); if (entry == null) { 284 entry = buildModel.getFactory().createEntry("bin.includes"); build.add(entry); 286 } 287 if (!entry.contains(filename)) 288 entry.addToken(filename); 289 } 290 } catch (CoreException e) { 291 } 292 } 293 294 public boolean monitoredFileRemoved(IFile file) { 295 return true; 299 } 300 public void editorContextAdded(InputContext context) { 301 addSourcePage(context.getId()); 302 try { 303 if (context.getId().equals(BuildInputContext.CONTEXT_ID)) 304 addPage(BUILD_INDEX, new BuildPage(this)); 305 else { 306 updateFirstThreePages(); 307 } 308 } 309 catch (PartInitException e) { 310 PDEPlugin.logException(e); 311 } 312 } 313 public void contextRemoved(InputContext context) { 314 close(true); 315 } 316 317 private void updateFirstThreePages() { 318 try { 319 int index = getActivePage(); 320 removePage(0); 321 removePage(0); 322 removePage(0); 323 addPage(0, new RuntimePage(this)); 324 addPage(0, new DependenciesPage(this)); 325 addPage(0, new OverviewPage(this)); 326 setActivePage(index); 327 } catch (PartInitException e) { 328 PDEPlugin.logException(e); 329 } 330 } 331 332 protected void createSystemFileContexts(InputContextManager manager, 333 SystemFileEditorInput input) { 334 File file = (File ) input.getAdapter(File .class); 335 File manifestFile = null; 336 File buildFile = null; 337 File pluginFile = null; 338 String name = file.getName().toLowerCase(Locale.ENGLISH); 339 if (name.equals("manifest.mf")) { manifestFile = file; 341 File dir = file.getParentFile().getParentFile(); 342 buildFile = new File (dir, "build.properties"); pluginFile = createPluginFile(dir); 344 } else if (name.equals("build.properties")) { buildFile = file; 346 File dir = file.getParentFile(); 347 pluginFile = createPluginFile(dir); 348 manifestFile = new File (dir, "META-INF/MANIFEST.MF"); } else if (name.equals("plugin.xml") || name.equals("fragment.xml")) { pluginFile = file; 351 File dir = file.getParentFile(); 352 buildFile = new File (dir, "build.properties"); manifestFile = new File (dir, "META-INF/MANIFEST.MF"); } 355 if (manifestFile.exists()) { 356 IEditorInput in = new SystemFileEditorInput(manifestFile); 357 manager.putContext(in, new BundleInputContext(this, in, 358 file == manifestFile)); 359 } 360 if (pluginFile.exists()) { 361 SystemFileEditorInput in = new SystemFileEditorInput(pluginFile); 362 manager.putContext(in, new PluginInputContext(this, in, 363 file == pluginFile, name.equals("fragment.xml"))); } 365 if (buildFile.exists()) { 366 SystemFileEditorInput in = new SystemFileEditorInput(buildFile); 367 manager.putContext(in, new BuildInputContext(this, in, 368 file == buildFile)); 369 } 370 } 371 private File createPluginFile(File dir) { 372 File pluginFile = new File (dir, "plugin.xml"); if (!pluginFile.exists()) 374 pluginFile = new File (dir, "fragment.xml"); return pluginFile; 376 } 377 378 private IFile createPluginFile(IContainer container) { 379 IFile pluginFile = container.getFile(new Path("plugin.xml")); if (!pluginFile.exists()) 381 pluginFile = container.getFile(new Path("fragment.xml")); return pluginFile; 383 } 384 385 protected void createStorageContexts(InputContextManager manager, 386 IStorageEditorInput input) { 387 if (input instanceof JarEntryEditorInput) { 388 createJarEntryContexts(manager, (JarEntryEditorInput)input); 389 return; 390 } 391 392 String name = input.getName().toLowerCase(Locale.ENGLISH); 393 if (name.startsWith("manifest.mf")) { manager 395 .putContext(input, 396 new BundleInputContext(this, input, true)); 397 } else if (name.startsWith("build.properties")) { manager.putContext(input, new BuildInputContext(this, input, true)); 399 } else if (name.startsWith("plugin.xml")) { manager.putContext(input, new PluginInputContext(this, input, true, 401 false)); 402 } else if (name.startsWith("fragment.xml")) { manager.putContext(input, new PluginInputContext(this, input, true, 404 true)); 405 } 406 } 407 408 protected void createJarEntryContexts(InputContextManager manager, 409 JarEntryEditorInput input) { 410 IStorage storage = input.getStorage(); 411 ZipFile zip = (ZipFile )storage.getAdapter(ZipFile .class); 412 try { 413 if (zip == null) 414 return; 415 416 if (zip.getEntry("META-INF/MANIFEST.MF") != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, "META-INF/MANIFEST.MF")); manager.putContext(input, new BundleInputContext(this, input, storage.getName().equals("MANIFEST.MF"))); } 420 421 if (zip.getEntry("plugin.xml") != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, "plugin.xml")); manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals("plugin.xml"), false)); } else if (zip.getEntry("fragment.xml") != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, "fragment.xml")); manager.putContext(input, new PluginInputContext(this, input, storage.getName().equals("fragment.xml"), true)); } 428 429 if (zip.getEntry("build.properties") != null) { input = new JarEntryEditorInput(new JarEntryFile(zip, "build.properties")); manager.putContext(input, new BuildInputContext(this, input, storage.getName().equals("build.properties"))); } 433 } finally { 434 try { 435 if (zip != null) 436 zip.close(); 437 } catch (IOException e) { 438 } 439 } 440 } 441 442 protected void addEditorPages() { 443 try { 444 addPage(new OverviewPage(this)); 445 addPage(new DependenciesPage(this)); 446 addPage(new RuntimePage(this)); 447 if (showExtensionTabs()) { 448 addExtensionTabs(); 449 } 450 if (fInputContextManager.hasContext(BuildInputContext.CONTEXT_ID)) 451 addPage(new BuildPage(this)); 452 } catch (PartInitException e) { 453 PDEPlugin.logException(e); 454 } 455 addSourcePage(BundleInputContext.CONTEXT_ID); 456 addSourcePage(PluginInputContext.CONTEXT_ID); 457 addSourcePage(BuildInputContext.CONTEXT_ID); 458 } 459 460 464 private boolean isSourcePageID(String pageID) { 465 if (pageID == null) { 467 return false; 468 } else if (pageID.equals(BuildInputContext.CONTEXT_ID)) { 469 return true; 471 } else if (pageID.equals(PluginInputContext.CONTEXT_ID)) { 472 return true; 474 } else if (pageID.equals(BundleInputContext.CONTEXT_ID)) { 475 return true; 477 } 478 return false; 479 } 480 481 484 protected String computeInitialPageId() { 485 if (SHOW_SOURCE) { 487 SHOW_SOURCE = false; 488 return getPrimarySourceInputContextID(); 489 } 490 String firstPageId = super.computeInitialPageId(); 492 if (firstPageId == null) { 497 return OverviewPage.PAGE_ID; 498 } else if (isSourcePageID(firstPageId)) { 499 return getPrimarySourceInputContextID(); 500 } 501 502 return firstPageId; 503 } 504 505 508 protected String getPropertyEditorPageKey(IFileEditorInput input) { 509 IFile file = input.getFile(); 517 IProject project = file.getProject(); 518 if (project == null) { 520 return super.getPropertyEditorPageKey(input); 522 } 523 try { 525 return project.getPersistentProperty( 526 IPDEUIConstants.PROPERTY_MANIFEST_EDITOR_PAGE_KEY); 527 } catch (CoreException e) { 528 return super.getPropertyEditorPageKey(input); 530 } 531 } 532 533 536 protected void setPropertyEditorPageKey(IFileEditorInput input, 537 String pageId) { 538 IFile file = input.getFile(); 546 IProject project = file.getProject(); 547 if (project == null) { 549 super.setPropertyEditorPageKey(input, pageId); 551 return; 552 } 553 try { 555 project.setPersistentProperty( 556 IPDEUIConstants.PROPERTY_MANIFEST_EDITOR_PAGE_KEY, 557 pageId); 558 } catch (CoreException e) { 559 super.setPropertyEditorPageKey(input, pageId); 561 return; 562 } 563 } 564 565 568 private String getPrimarySourceInputContextID() { 569 InputContext primary = fInputContextManager.getPrimaryContext(); 571 if (primary == null) { 573 return null; 574 } 575 return primary.getId(); 577 } 578 579 582 protected PDESourcePage createSourcePage(PDEFormEditor editor, String title, String name, String contextId) { 583 if (contextId.equals(PluginInputContext.CONTEXT_ID)) 584 return new ManifestSourcePage(editor, title, name); 585 if (contextId.equals(BuildInputContext.CONTEXT_ID)) 586 return new BuildSourcePage(editor, title, name); 587 if (contextId.equals(BundleInputContext.CONTEXT_ID)) 588 return new BundleSourcePage(editor, title, name); 589 return super.createSourcePage(editor, title, name, contextId); 590 } 591 592 protected ISortableContentOutlinePage createContentOutline() { 593 return new ManifestOutlinePage(this); 594 } 595 596 public Object getAdapter(Class key) { 597 if (key.equals(IPropertySheetPage.class)) { 599 return null; 600 } 601 return super.getAdapter(key); 602 } 603 604 605 public String getTitle() { 606 IPluginModelBase model = (IPluginModelBase)getAggregateModel(); 607 if (model==null || !model.isValid()) 608 return super.getTitle(); 609 String text = getTitleText(model.getPluginBase()); 610 if (text == null) 611 return super.getTitle(); 612 return model.getResourceString(text); 613 } 614 615 public String getTitleProperty() { 616 IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore(); 617 String pref = store.getString(IPreferenceConstants.PROP_SHOW_OBJECTS); 618 if (pref!=null && pref.equals(IPreferenceConstants.VALUE_USE_NAMES)) 619 return IPluginObject.P_NAME; 620 return IIdentifiable.P_ID; 621 } 622 623 private String getTitleText(IPluginBase pluginBase) { 624 IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore(); 625 String pref = store.getString(IPreferenceConstants.PROP_SHOW_OBJECTS); 626 if (pref!=null && pref.equals(IPreferenceConstants.VALUE_USE_NAMES)) 627 return pluginBase.getName(); 628 return pluginBase.getId(); 629 } 630 631 634 protected InputContext getInputContext(Object object) { 635 InputContext context = null; 636 if (object instanceof IFile) { 637 String name = ((IFile)object).getName(); 638 if (name.equals("plugin.xml") || name.equals("fragment.xml")) context = fInputContextManager.findContext(PluginInputContext.CONTEXT_ID); 640 else if (name.equals("MANIFEST.MF")) context = fInputContextManager.findContext(BundleInputContext.CONTEXT_ID); 642 else if (name.equals("build.properties")) context = fInputContextManager.findContext(BuildInputContext.CONTEXT_ID); 644 } else if (object instanceof IBuildObject) { 645 context = fInputContextManager.findContext(BuildInputContext.CONTEXT_ID); 646 } else if (object instanceof IPluginExtensionPoint || object instanceof IPluginExtension) { 647 context = fInputContextManager.findContext(PluginInputContext.CONTEXT_ID); 648 } else { 649 context = fInputContextManager.findContext(BundleInputContext.CONTEXT_ID); 650 if (context == null) 651 context = fInputContextManager.findContext(PluginInputContext.CONTEXT_ID); 652 } 653 return context; 654 } 655 656 659 public void showEditorInput(IEditorInput editorInput) { 660 String name = editorInput.getName(); 661 String id = getActivePageInstance().getId(); 662 if (name.equals("build.properties")) { if (!BuildInputContext.CONTEXT_ID.equals(id)) 664 setActivePage(SHOW_SOURCE ? BuildInputContext.CONTEXT_ID : BuildPage.PAGE_ID); 665 } else if (name.equals("plugin.xml") || name.equals("fragment.xml")) { if (!PluginInputContext.CONTEXT_ID.equals(id)) { 667 if (SHOW_SOURCE) { 668 setActivePage(PluginInputContext.CONTEXT_ID); 669 } else if (fInputContextManager.hasContext(BundleInputContext.CONTEXT_ID)) { 670 setActivePage(ExtensionsPage.PAGE_ID); 671 } else { 672 setActivePage(OverviewPage.PAGE_ID); 673 } 674 } 675 } else if (!BundleInputContext.CONTEXT_ID.equals(id)) { 676 setActivePage(SHOW_SOURCE ? BundleInputContext.CONTEXT_ID : OverviewPage.PAGE_ID); 677 } 678 } 679 680 public boolean showExtensionTabs() { 681 if (fInputContextManager.hasContext(PluginInputContext.CONTEXT_ID)) 682 return true; 683 IBaseModel model = getAggregateModel(); 684 return fShowExtensions && model != null && model.isEditable(); 685 } 686 687 public boolean isEquinox() { 688 return fEquinox; 689 } 690 691 protected void addExtensionTabs() throws PartInitException { 692 addPage(3, new ExtensionPointsPage(this)); 693 addPage(3, new ExtensionsPage(this)); 694 } 695 696 protected void setShowExtensions(boolean show) throws BackingStoreException { 697 if (fPrefs != null) { 698 fPrefs.putBoolean(ICoreConstants.EXTENSIONS_PROPERTY, show); 699 fPrefs.flush(); 700 } 701 fShowExtensions = show; 702 } 703 } 704 | Popular Tags |