Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2024 Obeo.
* Copyright (c) 2017, 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -12,11 +12,11 @@
package org.obeonetwork.m2doc.element;

/**
* An bookmark that can be returned by services.
* A bookmark that can be returned by services.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface MBookmark extends MElement {
public interface MBookmark extends MIdentifiable {

/**
* Gets the text to display.
Expand All @@ -33,45 +33,4 @@ public interface MBookmark extends MElement {
*/
void setText(String text);

/**
* Gets the bookmark ID.
*
* @return the bookmark ID
*/
String getId();

/**
* Sets the bookmark ID.
*
* @param id
* the new bookmark ID
*/
void setId(String id);

/**
* Tells if this is a reference to a {@link MBookmark} or a {@link MBookmark} declaration.
*
* @return <code>true</code> if this is a reference to a {@link MBookmark}, <code>false</code> if it's a {@link MBookmark}
* declaration
*/
boolean isReference();

/**
* Tells if this reference can be omitted when the bookmark declaration doesn't exists.
*
* @return <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
* error
* should be raised.
*/
boolean isOptional();

/**
* Sets if this reference can be omitted when the bookmark declaration doesn't exists.
*
* @param optional
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
* error
*/
void setOptional(boolean optional);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element;

/**
* A bookmark with a custom text reference (insert the custom text and reference the bookmark).
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface MBookmarkCustomTextRef extends MBookmarkRef {

/**
* Gets the text to display.
*
* @return the text to display
*/
String getText();

/**
* Sets the text to display.
*
* @param text
* the new text to display
*/
void setText(String text);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element;

/**
* A bookmark page reference (insert the page number of the referenced bookmark).
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface MBookmarkPageRef extends MBookmarkRef {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element;

/**
* A bookmark reference.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface MBookmarkRef extends MIdentifiable {

/**
* Tells if this reference can be omitted when the bookmark declaration doesn't exists.
*
* @return <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
* error
* should be raised.
*/
boolean isOptional();

/**
* Sets if this reference can be omitted when the bookmark declaration doesn't exists.
*
* @param optional
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code> if an
* error
*/
void setOptional(boolean optional);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element;

/**
* A bookmark section reference (insert the section name of the referenced bookmark).
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface MBookmarkSectionRef extends MBookmarkRef {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element;

/**
* A bookmark text reference (insert the text of the referenced bookmark).
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface MBookmarkTextRef extends MBookmarkRef {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element;

/**
* Identifiable {@link MElement}.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface MIdentifiable extends MElement {

/**
* Gets the ID.
*
* @return the ID
*/
String getId();

/**
* Sets the ID.
*
* @param id
* the new ID
*/
void setId(String id);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element.impl;

import org.obeonetwork.m2doc.element.MBookmarkRef;

/**
* Abstract implementation of {@link MBookmarkRef}.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public class AbstractMBookmarkRef implements MBookmarkRef {

/**
* The bookmark ID.
*/
private String id;

/**
* Tells if this reference can be omitted when the bookmark declaration doesn't exists.
*/
private boolean optional;

/**
* Constructor.
*
* @param id
* the bookmark id
* @param optional
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code>
* otherwise
*/
public AbstractMBookmarkRef(String id, boolean optional) {
this.id = id;
this.optional = optional;
}

@Override
public String getId() {
return id;
}

@Override
public void setId(String id) {
this.id = id;
}

@Override
public boolean isOptional() {
return optional;
}

@Override
public void setOptional(boolean optional) {
this.optional = optional;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright (c) 2025 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.element.impl;

import org.obeonetwork.m2doc.element.MBookmarkCustomTextRef;

/**
* A bookmark text reference (insert the text of the referenced bookmark).
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public class MBookmarkCustomTextRefImpl extends AbstractMBookmarkRef implements MBookmarkCustomTextRef {

/**
* The text to display.
*/
private String text;

/**
* Constructor.
*
* @param text
* the custom text
* @param id
* the bookmark id
* @param optional
* <code>true</code> if this reference can be omitted when the bookmark declaration doesn't exists, <code>false</code>
* otherwise
*/
public MBookmarkCustomTextRefImpl(String text, String id, boolean optional) {
super(id, optional);
this.text = text;
}

@Override
public String getText() {
return text;
}

@Override
public void setText(String text) {
this.text = text;
}

}
Loading