Skip to content

Commit 7d5884a

Browse files
committed
Fixed #430 Add support for section numbering and page numbering bookmark references.
1 parent 356a38c commit 7d5884a

File tree

89 files changed

+895
-105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+895
-105
lines changed
Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017, 2024 Obeo.
2+
* Copyright (c) 2017, 2025 Obeo.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v2.0
55
* which accompanies this distribution, and is available at
@@ -12,11 +12,11 @@
1212
package org.obeonetwork.m2doc.element;
1313

1414
/**
15-
* An bookmark that can be returned by services.
15+
* A bookmark that can be returned by services.
1616
*
1717
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
1818
*/
19-
public interface MBookmark extends MElement {
19+
public interface MBookmark extends MIdentifiable {
2020

2121
/**
2222
* Gets the text to display.
@@ -33,45 +33,4 @@ public interface MBookmark extends MElement {
3333
*/
3434
void setText(String text);
3535

36-
/**
37-
* Gets the bookmark ID.
38-
*
39-
* @return the bookmark ID
40-
*/
41-
String getId();
42-
43-
/**
44-
* Sets the bookmark ID.
45-
*
46-
* @param id
47-
* the new bookmark ID
48-
*/
49-
void setId(String id);
50-
51-
/**
52-
* Tells if this is a reference to a {@link MBookmark} or a {@link MBookmark} declaration.
53-
*
54-
* @return <code>true</code> if this is a reference to a {@link MBookmark}, <code>false</code> if it's a {@link MBookmark}
55-
* declaration
56-
*/
57-
boolean isReference();
58-
59-
/**
60-
* Tells if this reference can be omitted when the bookmark declaration doesn't exists.
61-
*
62-
* @return <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
63-
* error
64-
* should be raised.
65-
*/
66-
boolean isOptional();
67-
68-
/**
69-
* Sets if this reference can be omitted when the bookmark declaration doesn't exists.
70-
*
71-
* @param optional
72-
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
73-
* error
74-
*/
75-
void setOptional(boolean optional);
76-
7736
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element;
13+
14+
/**
15+
* A bookmark with a custom text reference (insert the custom text and reference the bookmark).
16+
*
17+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
18+
*/
19+
public interface MBookmarkCustomTextRef extends MBookmarkRef {
20+
21+
/**
22+
* Gets the text to display.
23+
*
24+
* @return the text to display
25+
*/
26+
String getText();
27+
28+
/**
29+
* Sets the text to display.
30+
*
31+
* @param text
32+
* the new text to display
33+
*/
34+
void setText(String text);
35+
36+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element;
13+
14+
/**
15+
* A bookmark page reference (insert the page number of the referenced bookmark).
16+
*
17+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
18+
*/
19+
public interface MBookmarkPageRef extends MBookmarkRef {
20+
21+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element;
13+
14+
/**
15+
* A bookmark reference.
16+
*
17+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
18+
*/
19+
public interface MBookmarkRef extends MIdentifiable {
20+
21+
/**
22+
* Tells if this reference can be omitted when the bookmark declaration doesn't exists.
23+
*
24+
* @return <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
25+
* error
26+
* should be raised.
27+
*/
28+
boolean isOptional();
29+
30+
/**
31+
* Sets if this reference can be omitted when the bookmark declaration doesn't exists.
32+
*
33+
* @param optional
34+
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
35+
* error
36+
*/
37+
void setOptional(boolean optional);
38+
39+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element;
13+
14+
/**
15+
* A bookmark section reference (insert the section name of the referenced bookmark).
16+
*
17+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
18+
*/
19+
public interface MBookmarkSectionRef extends MBookmarkRef {
20+
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element;
13+
14+
/**
15+
* A bookmark text reference (insert the text of the referenced bookmark).
16+
*
17+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
18+
*/
19+
public interface MBookmarkTextRef extends MBookmarkRef {
20+
21+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element;
13+
14+
/**
15+
* Identifiable {@link MElement}.
16+
*
17+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
18+
*/
19+
public interface MIdentifiable extends MElement {
20+
21+
/**
22+
* Gets the ID.
23+
*
24+
* @return the ID
25+
*/
26+
String getId();
27+
28+
/**
29+
* Sets the ID.
30+
*
31+
* @param id
32+
* the new ID
33+
*/
34+
void setId(String id);
35+
36+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element.impl;
13+
14+
import org.obeonetwork.m2doc.element.MBookmarkRef;
15+
16+
/**
17+
* Abstract implementation of {@link MBookmarkRef}.
18+
*
19+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
20+
*/
21+
public class AbstractMBookmarkRef implements MBookmarkRef {
22+
23+
/**
24+
* The bookmark ID.
25+
*/
26+
private String id;
27+
28+
/**
29+
* Tells if this reference can be omitted when the bookmark declaration doesn't exists.
30+
*/
31+
private boolean optional;
32+
33+
/**
34+
* Constructor.
35+
*
36+
* @param id
37+
* the bookmark id
38+
* @param optional
39+
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code>
40+
* otherwise
41+
*/
42+
public AbstractMBookmarkRef(String id, boolean optional) {
43+
this.id = id;
44+
this.optional = optional;
45+
}
46+
47+
@Override
48+
public String getId() {
49+
return id;
50+
}
51+
52+
@Override
53+
public void setId(String id) {
54+
this.id = id;
55+
}
56+
57+
@Override
58+
public boolean isOptional() {
59+
return optional;
60+
}
61+
62+
@Override
63+
public void setOptional(boolean optional) {
64+
this.optional = optional;
65+
}
66+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Obeo.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v20.html
7+
*
8+
* Contributors:
9+
* Obeo - initial API and implementation
10+
*
11+
*******************************************************************************/
12+
package org.obeonetwork.m2doc.element.impl;
13+
14+
import org.obeonetwork.m2doc.element.MBookmarkCustomTextRef;
15+
16+
/**
17+
* A bookmark text reference (insert the text of the referenced bookmark).
18+
*
19+
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
20+
*/
21+
public class MBookmarkCustomTextRefImpl extends AbstractMBookmarkRef implements MBookmarkCustomTextRef {
22+
23+
/**
24+
* The text to display.
25+
*/
26+
private String text;
27+
28+
/**
29+
* Constructor.
30+
*
31+
* @param text
32+
* the custom text
33+
* @param id
34+
* the bookmark id
35+
* @param optional
36+
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code>
37+
* otherwise
38+
*/
39+
public MBookmarkCustomTextRefImpl(String text, String id, boolean optional) {
40+
super(id, optional);
41+
this.text = text;
42+
}
43+
44+
@Override
45+
public String getText() {
46+
return text;
47+
}
48+
49+
@Override
50+
public void setText(String text) {
51+
this.text = text;
52+
}
53+
54+
}

0 commit comments

Comments
 (0)