https://bugs.webkit.org/show_bug.cgi?id=178045
<rdar://problem/
35174307>
Reviewed by Brian Burg.
Source/WebInspectorUI:
* UserInterface/Models/Collection.js:
(WI.Collection):
(WI.Collection.prototype.get displayName):
(WI.Collection.prototype.objectIsRequiredType):
(WI.Collection.prototype.add):
(WI.Collection.prototype.get typeVerifier): Deleted.
Instead of exposing the typeVerifier, we create a public predicate that returns whether the
given object matches the expected type of the Collection. Subclasses can override it to
limit the scope of the collection to a particular type.
* UserInterface/Models/CollectionTypes.js:
(WI.FrameCollection.prototype.get displayName):
(WI.FrameCollection.prototype.objectIsRequiredType):
(WI.FrameCollection): Deleted.
(WI.ScriptCollection.prototype.get displayName):
(WI.ScriptCollection.prototype.objectIsRequiredType):
(WI.ScriptCollection): Deleted.
(WI.CSSStyleSheetCollection.prototype.get displayName):
(WI.CSSStyleSheetCollection.prototype.objectIsRequiredType):
(WI.CSSStyleSheetCollection): Deleted.
(WI.CanvasCollection.prototype.get displayName):
(WI.CanvasCollection.prototype.objectIsRequiredType):
(WI.CanvasCollection): Deleted.
(WI.ShaderProgramCollection.prototype.get displayName):
(WI.ShaderProgramCollection.prototype.objectIsRequiredType):
(WI.ShaderProgramCollection): Deleted.
(WI.RecordingCollection.prototype.get displayName):
(WI.RecordingCollection.prototype.objectIsRequiredType):
(WI.RecordingCollection): Deleted.
* UserInterface/Models/ResourceCollection.js:
(WI.ResourceCollection):
(WI.ResourceCollection.prototype.get displayName):
(WI.ResourceCollection.prototype.objectIsRequiredType):
(WI.ResourceCollection.verifierForType): Deleted.
* UserInterface/Views/TreeOutlineGroup.js:
(WI.TreeOutlineGroup.prototype.objectIsRequiredType):
(WI.TreeOutlineGroup): Deleted.
Introduce additional subclasses of Collection for other model types. Modify existing
subclasses to remove `typeVerifier` and instead extend `objectIsRequiredType`.
* UserInterface/Models/Canvas.js:
(WI.Canvas):
* UserInterface/Models/Frame.js:
(WI.Frame):
* UserInterface/Protocol/Target.js:
(WI.Target):
* UserInterface/Views/ResourceSidebarPanel.js:
(WI.ResourceSidebarPanel.prototype.treeElementForRepresentedObject):
(WI.ResourceSidebarPanel.prototype._addScript):
* UserInterface/Views/CollectionContentView.js:
(WI.CollectionContentView):
(WI.CollectionContentView.titleForCollection): Delete.
* UserInterface/Views/ResourceCollectionContentView.js:
(WI.ResourceCollectionContentView):
Require that subclasses of Collection override `get displayName` if the CollectionContentView
is not provided with a `contentPlaceholderText`.
(WI.CollectionContentView.prototype.initialLayout):
We don't need to create and add ContentView for each item of the Collection, as this is
already done by attached().
(WI.CollectionContentView.prototype._showContentPlaceholder):
Remove the 250ms delay before showing the placeholder TitleView.
* UserInterface/Views/FolderizedTreeElement.js:
(WI.FolderizedTreeElement.prototype._settingsForRepresentedObject):
LayoutTests:
* inspector/unit-tests/collection-expected.txt:
* inspector/unit-tests/collection.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223997
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-10-25 Devin Rousso <webkit@devinrousso.com>
+
+ Web Inspector: replace TypeVerifier with subclasses of WI.Collection
+ https://bugs.webkit.org/show_bug.cgi?id=178045
+ <rdar://problem/35174307>
+
+ Reviewed by Brian Burg.
+
+ * inspector/unit-tests/collection-expected.txt:
+ * inspector/unit-tests/collection.html:
+
2017-10-25 Youenn Fablet <youenn@apple.com>
Add service worker handle fetch support for all subresource requests
["one","two",3]
[]
--- Running test case: WI.Collection.prototype.get typeVerifier
+-- Running test case: WI.Collection.SpecifiedType
["one","two"]
["one","two"]
-PASS: typeVerifier is the given function.
<script>
function test()
{
- let suite = InspectorTest.createAsyncSuite("Collection");
+ class TestCollection extends WI.Collection {
+ objectIsRequiredType(object)
+ {
+ return true;
+ }
+ }
+
+ class StringCollection extends WI.Collection {
+ objectIsRequiredType(object)
+ {
+ return typeof object === "string";
+ }
+ }
+
+ let suite = InspectorTest.createSyncSuite("Collection");
suite.addTestCase({
name: "WI.Collection.prototype.add",
- test(resolve, reject) {
- let collection = new WI.Collection;
+ test() {
+ let collection = new TestCollection;
collection.add("one");
collection.add("two");
InspectorTest.log(collection);
- resolve();
+ return true;
}
});
suite.addTestCase({
name: "WI.Collection.prototype.remove",
- test(resolve, reject) {
+ test() {
let item = "one";
- let collection = new WI.Collection;
+ let collection = new TestCollection;
collection.add(item);
collection.add("two");
InspectorTest.log(collection);
- resolve();
+ return true;
}
});
suite.addTestCase({
name: "WI.Collection.prototype.clear",
- test(resolve, reject) {
- let collection = new WI.Collection;
+ test() {
+ let collection = new TestCollection;
collection.add("one");
collection.add("two");
collection.add(3);
InspectorTest.log(collection);
- resolve();
+ return true;
}
});
suite.addTestCase({
- name: "WI.Collection.prototype.get typeVerifier",
- test(resolve, reject) {
- function stringVerifier(object) {
- return typeof object === "string";
- }
-
- let collection = new WI.Collection(stringVerifier);
+ name: "WI.Collection.SpecifiedType",
+ test() {
+ let collection = new StringCollection;
collection.add("one");
collection.add("two");
collection.add(3);
InspectorTest.log(collection);
- InspectorTest.expectEqual(collection.typeVerifier, stringVerifier, "typeVerifier is the given function.");
- resolve();
+ return true;
}
});
2017-10-25 Devin Rousso <webkit@devinrousso.com>
- Web Inspector: Canvas Tab: clicking on a canvas card causes details sidebar to show and mess up card arrangement
- https://bugs.webkit.org/show_bug.cgi?id=178803
- <rdar://problem/35176082>
+ Web Inspector: replace TypeVerifier with subclasses of WI.Collection
+ https://bugs.webkit.org/show_bug.cgi?id=178045
+ <rdar://problem/35174307>
Reviewed by Brian Burg.
- * Localizations/en.lproj/localizedStrings.js:
- * UserInterface/Views/CanvasDetailsSidebarPanel.css:
- (.sidebar > .panel.details.canvas > .content > .empty-content-placeholder):
- (.sidebar > .panel.details.canvas > .content > .empty-content-placeholder > .message):
- * UserInterface/Views/CanvasDetailsSidebarPanel.js:
- (WI.CanvasDetailsSidebarPanel):
- (WI.CanvasDetailsSidebarPanel.prototype.inspect):
- (WI.CanvasDetailsSidebarPanel.prototype.initialLayout):
- (WI.CanvasDetailsSidebarPanel.prototype.layout):
+ * UserInterface/Models/Collection.js:
+ (WI.Collection):
+ (WI.Collection.prototype.get displayName):
+ (WI.Collection.prototype.objectIsRequiredType):
+ (WI.Collection.prototype.add):
+ (WI.Collection.prototype.get typeVerifier): Deleted.
+ Instead of exposing the typeVerifier, we create a public predicate that returns whether the
+ given object matches the expected type of the Collection. Subclasses can override it to
+ limit the scope of the collection to a particular type.
- * UserInterface/Views/RecordingNavigationSidebarPanel.js:
- (WI.RecordingNavigationSidebarPanel.disallowInstanceForClass): Deleted.
- * UserInterface/Views/RecordingStateDetailsSidebarPanel.js:
- (WI.RecordingStateDetailsSidebarPanel.disallowInstanceForClass): Deleted.
- * UserInterface/Views/RecordingTraceDetailsSidebarPanel.js:
- (WI.RecordingTraceDetailsSidebarPanel.disallowInstanceForClass): Deleted.
- Drive-by: these sidebar panels are now only used by the Canvas tab, so we no longer need to
- provide support for multiple instances of them.
+ * UserInterface/Models/CollectionTypes.js:
+ (WI.FrameCollection.prototype.get displayName):
+ (WI.FrameCollection.prototype.objectIsRequiredType):
+ (WI.FrameCollection): Deleted.
+ (WI.ScriptCollection.prototype.get displayName):
+ (WI.ScriptCollection.prototype.objectIsRequiredType):
+ (WI.ScriptCollection): Deleted.
+ (WI.CSSStyleSheetCollection.prototype.get displayName):
+ (WI.CSSStyleSheetCollection.prototype.objectIsRequiredType):
+ (WI.CSSStyleSheetCollection): Deleted.
+ (WI.CanvasCollection.prototype.get displayName):
+ (WI.CanvasCollection.prototype.objectIsRequiredType):
+ (WI.CanvasCollection): Deleted.
+ (WI.ShaderProgramCollection.prototype.get displayName):
+ (WI.ShaderProgramCollection.prototype.objectIsRequiredType):
+ (WI.ShaderProgramCollection): Deleted.
+ (WI.RecordingCollection.prototype.get displayName):
+ (WI.RecordingCollection.prototype.objectIsRequiredType):
+ (WI.RecordingCollection): Deleted.
+ * UserInterface/Models/ResourceCollection.js:
+ (WI.ResourceCollection):
+ (WI.ResourceCollection.prototype.get displayName):
+ (WI.ResourceCollection.prototype.objectIsRequiredType):
+ (WI.ResourceCollection.verifierForType): Deleted.
+ * UserInterface/Views/TreeOutlineGroup.js:
+ (WI.TreeOutlineGroup.prototype.objectIsRequiredType):
+ (WI.TreeOutlineGroup): Deleted.
+ Introduce additional subclasses of Collection for other model types. Modify existing
+ subclasses to remove `typeVerifier` and instead extend `objectIsRequiredType`.
+
+ * UserInterface/Models/Canvas.js:
+ (WI.Canvas):
+ * UserInterface/Models/Frame.js:
+ (WI.Frame):
+ * UserInterface/Protocol/Target.js:
+ (WI.Target):
+ * UserInterface/Views/ResourceSidebarPanel.js:
+ (WI.ResourceSidebarPanel.prototype.treeElementForRepresentedObject):
+ (WI.ResourceSidebarPanel.prototype._addScript):
+
+ * UserInterface/Views/CollectionContentView.js:
+ (WI.CollectionContentView):
+ (WI.CollectionContentView.titleForCollection): Delete.
+ * UserInterface/Views/ResourceCollectionContentView.js:
+ (WI.ResourceCollectionContentView):
+ Require that subclasses of Collection override `get displayName` if the CollectionContentView
+ is not provided with a `contentPlaceholderText`.
+
+ (WI.CollectionContentView.prototype.initialLayout):
+ We don't need to create and add ContentView for each item of the Collection, as this is
+ already done by attached().
+
+ (WI.CollectionContentView.prototype._showContentPlaceholder):
+ Remove the 250ms delay before showing the placeholder TitleView.
+
+ * UserInterface/Views/FolderizedTreeElement.js:
+ (WI.FolderizedTreeElement.prototype._settingsForRepresentedObject):
2017-10-25 Joseph Pecoraro <pecoraro@apple.com>
2017-10-25 Devin Rousso <webkit@devinrousso.com>
+ Web Inspector: Canvas Tab: clicking on a canvas card causes details sidebar to show and mess up card arrangement
+ https://bugs.webkit.org/show_bug.cgi?id=178803
+ <rdar://problem/35176082>
+
+ Reviewed by Brian Burg.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ * UserInterface/Views/CanvasDetailsSidebarPanel.css:
+ (.sidebar > .panel.details.canvas > .content > .empty-content-placeholder):
+ (.sidebar > .panel.details.canvas > .content > .empty-content-placeholder > .message):
+ * UserInterface/Views/CanvasDetailsSidebarPanel.js:
+ (WI.CanvasDetailsSidebarPanel):
+ (WI.CanvasDetailsSidebarPanel.prototype.inspect):
+ (WI.CanvasDetailsSidebarPanel.prototype.initialLayout):
+ (WI.CanvasDetailsSidebarPanel.prototype.layout):
+
+ * UserInterface/Views/RecordingNavigationSidebarPanel.js:
+ (WI.RecordingNavigationSidebarPanel.disallowInstanceForClass): Deleted.
+ * UserInterface/Views/RecordingStateDetailsSidebarPanel.js:
+ (WI.RecordingStateDetailsSidebarPanel.disallowInstanceForClass): Deleted.
+ * UserInterface/Views/RecordingTraceDetailsSidebarPanel.js:
+ (WI.RecordingTraceDetailsSidebarPanel.disallowInstanceForClass): Deleted.
+ Drive-by: these sidebar panels are now only used by the Canvas tab, so we no longer need to
+ provide support for multiple instances of them.
+
+2017-10-25 Devin Rousso <webkit@devinrousso.com>
+
Web Inspector: preserve Recordings for each Canvas after closing the Canvas tab
https://bugs.webkit.org/show_bug.cgi?id=178767
<rdar://problem/35167239>
localizedStrings["Collapse All"] = "Collapse All";
localizedStrings["Collapse columns"] = "Collapse columns";
localizedStrings["Collect garbage"] = "Collect garbage";
-localizedStrings["Collection"] = "Collection";
localizedStrings["Color"] = "Color";
localizedStrings["Comment"] = "Comment";
localizedStrings["Comment All Properties"] = "Comment All Properties";
localizedStrings["Recording %d"] = "Recording %d";
localizedStrings["Recording Timeline Data"] = "Recording Timeline Data";
localizedStrings["Recording error: %s"] = "Recording error: %s";
+localizedStrings["Recordings"] = "Recordings";
localizedStrings["Reference Issue"] = "Reference Issue";
localizedStrings["Reflection"] = "Reflection";
localizedStrings["Refresh"] = "Refresh";
this._memoryCost = memoryCost || NaN;
this._cssCanvasClientNodes = null;
- this._shaderProgramCollection = new WI.Collection(WI.Collection.TypeVerifier.ShaderProgram);
+ this._shaderProgramCollection = new WI.ShaderProgramCollection;
this._recordingCollection = new WI.RecordingCollection;
this._nextShaderProgramDisplayNumber = 1;
WI.Collection = class Collection extends WI.Object
{
- constructor(typeVerifier)
+ constructor(items = [])
{
super();
this._items = new Set;
- console.assert(!typeVerifier || typeof typeVerifier === "function");
- this._typeVerifier = typeVerifier || WI.Collection.TypeVerifier.Any;
+ for (let item of items)
+ this.add(item);
}
- // Public
+ // Public
get items() { return this._items; }
- get typeVerifier() { return this._typeVerifier; }
+
+ get displayName()
+ {
+ throw WI.NotImplementedError.subclassMustOverride();
+ }
+
+ objectIsRequiredType(object)
+ {
+ throw WI.NotImplementedError.subclassMustOverride();
+ }
add(item)
{
- let isValidType = this._typeVerifier(item);
+ let isValidType = this.objectIsRequiredType(item);
console.assert(isValidType);
if (!isValidType)
return;
}
};
- WI.Collection.Event = {
+WI.Collection.Event = {
ItemAdded: "collection-item-added",
ItemRemoved: "collection-item-removed",
};
- WI.Collection.TypeVerifier = {
- Any: (object) => true,
- Frame: (object) => object instanceof WI.Frame,
- Resource: (object) => object instanceof WI.Resource,
- Script: (object) => object instanceof WI.Script,
- CSSStyleSheet: (object) => object instanceof WI.CSSStyleSheet,
- Canvas: (object) => object instanceof WI.Canvas,
- ShaderProgram: (object) => object instanceof WI.ShaderProgram,
-};
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2017 Devin Rousso <webkit@devinrousso.com>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+WI.FrameCollection = class FrameCollection extends WI.Collection
+{
+ // Public
+
+ get displayName()
+ {
+ return WI.UIString("Frames");
+ }
+
+ objectIsRequiredType(object)
+ {
+ return object instanceof WI.Frame;
+ }
+};
+
+WI.ScriptCollection = class ScriptCollection extends WI.Collection
+{
+ // Public
+
+ get displayName()
+ {
+ return WI.UIString("Scripts");
+ }
+
+ objectIsRequiredType(object)
+ {
+ return object instanceof WI.Script;
+ }
+};
+
+WI.CSSStyleSheetCollection = class CSSStyleSheetCollection extends WI.Collection
+{
+ // Public
+
+ get displayName()
+ {
+ return WI.UIString("Stylesheets");
+ }
+
+ objectIsRequiredType(object)
+ {
+ return object instanceof WI.CSSStyleSheet;
+ }
+};
+
+
WI.CanvasCollection = class CanvasCollection extends WI.Collection
{
- constructor(canvases = [])
+ // Public
+
+ get displayName()
{
- super((item) => item instanceof WI.Canvas);
+ return WI.UIString("Canvases");
+ }
- for (let canvas of canvases)
- this.add(canvas);
+ objectIsRequiredType(object)
+ {
+ return object instanceof WI.Canvas;
+ }
+};
+
+WI.ShaderProgramCollection = class ShaderProgramCollection extends WI.Collection
+{
+ // Public
+
+ get displayName()
+ {
+ return WI.UIString("Shader Programs");
+ }
+
+ objectIsRequiredType(object)
+ {
+ return object instanceof WI.ShaderProgram;
}
};
WI.RecordingCollection = class RecordingCollection extends WI.Collection
{
- constructor(recordings = [])
+ // Public
+
+ get displayName()
{
- super((item) => item instanceof WI.Recording);
+ return WI.UIString("Recordings");
+ }
- for (let recording of recordings)
- this.add(recording);
+ objectIsRequiredType(object)
+ {
+ return object instanceof WI.Recording;
}
};
this._resourceCollection = new WI.ResourceCollection;
this._provisionalResourceCollection = new WI.ResourceCollection;
- this._extraScriptCollection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+ this._extraScriptCollection = new WI.ScriptCollection;
- this._childFrameCollection = new WI.Collection(WI.Collection.TypeVerifier.Frame);
+ this._childFrameCollection = new WI.FrameCollection;
this._childFrameIdentifierMap = new Map;
this._parentFrame = null;
{
constructor(resourceType)
{
- super(WI.ResourceCollection.verifierForType(resourceType));
+ super();
this._resourceType = resourceType || null;
this._resourceURLMap = new Map;
this._resourcesTypeMap = new Map;
}
- // Static
-
- static verifierForType(type) {
- switch (type) {
- case WI.Resource.Type.Document:
- return WI.ResourceCollection.TypeVerifier.Document;
- case WI.Resource.Type.Stylesheet:
- return WI.ResourceCollection.TypeVerifier.Stylesheet;
- case WI.Resource.Type.Image:
- return WI.ResourceCollection.TypeVerifier.Image;
- case WI.Resource.Type.Font:
- return WI.ResourceCollection.TypeVerifier.Font;
- case WI.Resource.Type.Script:
- return WI.ResourceCollection.TypeVerifier.Script;
- case WI.Resource.Type.XHR:
- return WI.ResourceCollection.TypeVerifier.XHR;
- case WI.Resource.Type.Fetch:
- return WI.ResourceCollection.TypeVerifier.Fetch;
- case WI.Resource.Type.Ping:
- return WI.ResourceCollection.TypeVerifier.Ping;
- case WI.Resource.Type.Beacon:
- return WI.ResourceCollection.TypeVerifier.Beacon;
- case WI.Resource.Type.WebSocket:
- return WI.ResourceCollection.TypeVerifier.WebSocket;
- case WI.Resource.Type.Other:
- return WI.ResourceCollection.TypeVerifier.Other;
- default:
- return WI.Collection.TypeVerifier.Resource;
- }
- }
-
// Public
get resourceType() { return this._resourceType; }
+ get displayName()
+ {
+ const plural = true;
+ return this._resourceType ? WI.Resource.displayNameForType(this._resourceType, plural) : WI.UIString("Resources");
+ }
+
+ objectIsRequiredType(object)
+ {
+ if (!(object instanceof WI.Resource))
+ return false;
+
+ if (!this._resourceType)
+ return true;
+
+ if (this._resourceType === WI.Resource.Type.Stylesheet && object instanceof WI.CSSStyleSheet)
+ return true;
+
+ return object.type === this._resourceType;
+ }
+
resourceForURL(url)
{
return this._resourceURLMap.get(url) || null;
// above if statement).
}
};
-
-WI.ResourceCollection.TypeVerifier = {
- Document: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Document,
- Stylesheet: (object) => {
- if (WI.Collection.TypeVerifier.CSSStyleSheet(object))
- return true;
- return WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Stylesheet;
- },
- Image: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Image,
- Font: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Font,
- Script: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Script,
- XHR: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.XHR,
- Fetch: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Fetch,
- Ping: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Ping,
- Beacon: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Beacon,
- WebSocket: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.WebSocket,
- Other: (object) => WI.Collection.TypeVerifier.Resource(object) && object.type === WI.Resource.Type.Other,
-};
this._executionContext = null;
this._mainResource = null;
this._resourceCollection = new WI.ResourceCollection;
- this._extraScriptCollection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+ this._extraScriptCollection = new WI.ScriptCollection;
this._connection.target = this;
}
this.element.classList.add("collection");
- this._contentPlaceholderText = contentPlaceholderText || WI.CollectionContentView.titleForCollection(collection);
+ this._contentPlaceholderText = contentPlaceholderText || collection.displayName;
this._contentViewConstructor = contentViewConstructor;
this._contentViewMap = new Map;
this._handleClickMap = new WeakMap;
this._selectionEnabled = false;
}
- static titleForCollection(collection)
- {
- switch (collection.typeVerifier) {
- case WI.Collection.TypeVerifier.Frame:
- return WI.UIString("Frames");
- case WI.Collection.TypeVerifier.Resource:
- return WI.UIString("Resources");
- case WI.Collection.TypeVerifier.Script:
- return WI.UIString("Scripts");
- case WI.Collection.TypeVerifier.CSSStyleSheet:
- return WI.UIString("Stylesheets");
- case WI.Collection.TypeVerifier.Canvas:
- return WI.UIString("Canvases");
- case WI.Collection.TypeVerifier.ShaderProgram:
- return WI.UIString("Shader Programs");
- }
-
- console.warn("No default title for Collection type verifier.", collection.typeVerifier);
- return WI.UIString("Collection");
- }
-
// Public
get supplementalRepresentedObjects()
this._showContentPlaceholder();
return;
}
-
- for (let item of items)
- this.addContentViewForItem(item);
}
attached()
this._contentPlaceholder = new WI.TitleView(this._contentPlaceholderText);
if (!this._contentPlaceholder.parentView)
- this.debounce(250).addSubview(this._contentPlaceholder);
+ this.addSubview(this._contentPlaceholder);
}
_hideContentPlaceholder()
_settingsForRepresentedObject(representedObject)
{
for (let settings of this._folderizeSettingsMap.values()) {
- if (settings.representedObject.typeVerifier(representedObject))
+ if (settings.representedObject.objectIsRequiredType(representedObject))
return settings;
}
return null;
if (collection.resourceType === WI.Resource.Type.Image)
contentViewConstructor = WI.ImageResourceContentView;
- const plural = true;
- let contentPlaceholderText = WI.Resource.displayNameForType(collection.resourceType, plural);
-
- super(collection, contentViewConstructor, contentPlaceholderText);
+ super(collection, contentViewConstructor);
}
// Protected
// we have a ScriptContentView asking for the tree element we will make a ScriptTreeElement on demand and add it.
if (!this._anonymousScriptsFolderTreeElement) {
- let collection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+ let collection = new WI.ScriptCollection;
this._anonymousScriptsFolderTreeElement = new WI.FolderTreeElement(WI.UIString("Anonymous Scripts"), collection);
}
if (script.injected) {
if (!this._extensionScriptsFolderTreeElement) {
- let collection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+ let collection = new WI.ScriptCollection;
this._extensionScriptsFolderTreeElement = new WI.FolderTreeElement(WI.UIString("Extension Scripts"), collection);
}
insertIntoTopLevel = true;
else {
if (!this._extraScriptsFolderTreeElement) {
- let collection = new WI.Collection(WI.Collection.TypeVerifier.Script);
+ let collection = new WI.ScriptCollection;
this._extraScriptsFolderTreeElement = new WI.FolderTreeElement(WI.UIString("Extra Scripts"), collection);
}
WI.TreeOutlineGroup = class TreeOutlineGroup extends WI.Collection
{
- constructor()
- {
- super((object) => object instanceof WI.TreeOutline);
- }
-
// Static
static groupForTreeOutline(treeOutline)
// Public
+ objectIsRequiredType(object)
+ {
+ return object instanceof WI.TreeOutline;
+ }
+
get selectedTreeElement()
{
for (let treeOutline of this.items) {