Skip to content

Commit bb9e7e5

Browse files
Phaser Labs: a new Phaser Versions view.
1 parent 699f1a3 commit bb9e7e5

File tree

12 files changed

+393
-10
lines changed

12 files changed

+393
-10
lines changed

source/v2/phasereditor/phasereditor.ide/src/phasereditor/ide/ui/LabsPerspectiveFactory.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
import org.eclipse.ui.IFolderLayout;
44
import org.eclipse.ui.IPageLayout;
55
import org.eclipse.ui.IPerspectiveFactory;
6-
import org.eclipse.ui.navigator.resources.ProjectExplorer;
76

87
import phasereditor.chains.ui.views.ChainsView;
98
import phasereditor.inspect.ui.views.JsdocView;
109
import phasereditor.inspect.ui.views.PhaserExamplesView;
1110
import phasereditor.inspect.ui.views.PhaserFilesView;
1211
import phasereditor.inspect.ui.views.PhaserHierarchyView;
1312
import phasereditor.inspect.ui.views.PhaserTypesView;
13+
import phasereditor.inspect.ui.views.PhaserVersionsView;
1414
import phasereditor.project.ui.ProjectView;
1515

1616
public class LabsPerspectiveFactory implements IPerspectiveFactory {
1717

18+
private static final String FILES_AND_VERSIONS = "filesAndVersions";
1819
private static final String LEFT_FOLDER = "phasereditor.ide.left";
1920

2021
@Override
@@ -25,11 +26,17 @@ public void createInitialLayout(IPageLayout layout) {
2526

2627
layout.addView(PhaserTypesView.ID, IPageLayout.BOTTOM, 0.5f, LEFT_FOLDER);
2728
layout.addView(PhaserExamplesView.ID, IPageLayout.RIGHT, 0.8f, IPageLayout.ID_EDITOR_AREA);
28-
layout.addView(PhaserFilesView.ID, IPageLayout.RIGHT, 0.7f, IPageLayout.ID_EDITOR_AREA);
29-
layout.addView(JsdocView.ID, IPageLayout.BOTTOM, 0.5f, PhaserFilesView.ID);
30-
29+
30+
{
31+
var folder = layout.createFolder(FILES_AND_VERSIONS, IPageLayout.RIGHT, 0.7f, IPageLayout.ID_EDITOR_AREA);
32+
folder.addView(PhaserFilesView.ID);
33+
folder.addView(PhaserVersionsView.ID);
34+
}
35+
36+
layout.addView(JsdocView.ID, IPageLayout.BOTTOM, 0.5f, FILES_AND_VERSIONS);
37+
3138
layout.addView(ChainsView.ID, IPageLayout.BOTTOM, 0.6f, IPageLayout.ID_EDITOR_AREA);
32-
39+
3340
}
3441

3542
}

source/v2/phasereditor/phasereditor.inspect.core/src/phasereditor/inspect/core/jsdoc/PhaserJsdocModel.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,17 @@ private static void buildSince(IPhaserMember member) {
297297
if (member instanceof PhaserMember) {
298298
var json = member.getJSON();
299299
if (json.has("since")) {
300-
((PhaserMember) member).setSince(json.getString("since"));
300+
var since = json.getString("since").trim();
301+
since = since.split("\\s")[0];
302+
303+
var comps = since.split("\\.");
304+
if (comps.length == 3) {
305+
var v0 = Integer.parseInt(comps[0]);
306+
var v1 = Integer.parseInt(comps[1]);
307+
var v2 = Integer.parseInt(comps[2]);
308+
since = v0 + "." + v1 + "." + v2;
309+
((PhaserMember) member).setSince(since);
310+
}
301311
}
302312
}
303313
}

source/v2/phasereditor/phasereditor.inspect.ui/plugin.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,33 @@
3939
id="phasereditor.inspect.ui.views.PhaserHierarchyView"
4040
name="Phaser Hierarchy">
4141
</view>
42+
<view
43+
category="phasereditor.ui.phaser"
44+
class="phasereditor.inspect.ui.views.PhaserVersionsView"
45+
icon="platform:/plugin/phasereditor.ui/icons/tag-green.png"
46+
id="phasereditor.inspect.ui.views.PhaserVersionsView"
47+
name="Phaser Versions"
48+
restorable="true">
49+
</view>
4250
</extension>
4351
<extension
4452
point="org.eclipse.ui.menus">
53+
<menuContribution
54+
allPopups="false"
55+
locationURI="toolbar:phasereditor.inspect.ui.views.PhaserAPIHistoryView?after=additions">
56+
<command
57+
commandId="phasereditor.inspect.ui.showInHierarchy"
58+
style="push">
59+
</command>
60+
<command
61+
commandId="phasereditor.inspect.ui.showPhaserJsdoc"
62+
style="push">
63+
</command>
64+
<command
65+
commandId="phasereditor.inspect.ui.showSourceCode"
66+
style="push">
67+
</command>
68+
</menuContribution>
4569
<menuContribution
4670
allPopups="false"
4771
locationURI="toolbar:phasereditor.inspect.ui.views.PhaserTypesView?after=additions">

source/v2/phasereditor/phasereditor.inspect.ui/src/phasereditor/inspect/ui/PhaserElementLabelProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ public String getText(Object element) {
4343
if (element instanceof PhaserNamespace) {
4444
return ((PhaserNamespace) element).getSimpleName();
4545
}
46+
4647
if (element instanceof IPhaserMember) {
4748
return ((IPhaserMember) element).getName();
4849
}
50+
4951
return super.getText(element);
5052
}
5153

source/v2/phasereditor/phasereditor.inspect.ui/src/phasereditor/inspect/ui/PhaserElementStyledLabelProvider.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,38 @@ public class PhaserElementStyledLabelProvider extends StyledCellLabelProvider im
4646

4747
private Color _secondaryColor;
4848
private ILabelProvider _filterLabelProvider;
49+
private boolean _showContainerName;
4950

50-
public PhaserElementStyledLabelProvider(ILabelProvider filterLabelProvider) {
51+
public PhaserElementStyledLabelProvider(ILabelProvider filterLabelProvider, boolean showContainerName) {
5152
_filterLabelProvider = filterLabelProvider;
53+
_showContainerName = showContainerName;
54+
5255
updateStyleValues();
5356
}
5457

58+
public PhaserElementStyledLabelProvider(ILabelProvider filterLabelProvider) {
59+
this(filterLabelProvider, false);
60+
}
61+
5562
public void updateStyleValues() {
5663
_secondaryColor = JFaceResources.getColorRegistry().get(JFacePreferences.DECORATIONS_COLOR);
5764
}
5865

5966
@Override
6067
public void update(ViewerCell cell) {
6168

62-
Object element = cell.getElement();
69+
Object element = adaptElement(cell.getElement());
6370

6471
if (element instanceof PhaserGlobalScope) {
6572
cell.setText("[global]");
6673
cell.setImage(JsdocRenderer.getInstance().getGlobalScopeImage());
6774
return;
6875
}
6976

77+
if (element instanceof String) {
78+
cell.setText((String) element);
79+
}
80+
7081
if (!(element instanceof IPhaserMember)) {
7182
return;
7283
}
@@ -80,10 +91,14 @@ public void update(ViewerCell cell) {
8091
int secondaryTextIndex = -1;
8192

8293
if (member instanceof PhaserNamespace) {
83-
text = ((PhaserNamespace) member).getSimpleName();
94+
text = _showContainerName ? member.getName() : ((PhaserNamespace) member).getSimpleName();
8495
} else {
8596
text = member.getName();
8697

98+
if (_showContainerName) {
99+
text = member.getContainer().getName() + "." + text;
100+
}
101+
87102
if (member instanceof PhaserMethod) {
88103
PhaserMethod method = (PhaserMethod) member;
89104
StringBuilder sb = new StringBuilder();
@@ -122,6 +137,11 @@ public void update(ViewerCell cell) {
122137
super.update(cell);
123138
}
124139

140+
@SuppressWarnings("static-method")
141+
protected Object adaptElement(Object element) {
142+
return element;
143+
}
144+
125145
@Override
126146
public Image getImage(Object element) {
127147
return null;

source/v2/phasereditor/phasereditor.inspect.ui/src/phasereditor/inspect/ui/PhaserFileStyledLabelProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public PhaserFileStyledLabelProvider() {
4343

4444
@Override
4545
public void update(ViewerCell cell) {
46+
super.update(cell);
47+
4648
Object element = cell.getElement();
4749

4850
if (element instanceof Path) {
@@ -57,6 +59,6 @@ public void update(ViewerCell cell) {
5759
}
5860
}
5961

60-
super.update(cell);
62+
6163
}
6264
}

0 commit comments

Comments
 (0)